|
|
@@ -261,15 +261,18 @@ exports.applicationNotInstalled = function() {
|
|
|
|
|
|
exports.checkSearchIndicesGenerated = function(crowi, app) {
|
|
|
return function(req, res, next) {
|
|
|
- // build index
|
|
|
const searcher = crowi.getSearcher();
|
|
|
- searcher.buildIndex()
|
|
|
- .then((data) => {
|
|
|
- if (!data.errors) {
|
|
|
- debug('Index created.');
|
|
|
- }
|
|
|
- return searcher.addAllPages();
|
|
|
- });
|
|
|
+
|
|
|
+ // build index
|
|
|
+ if (searcher) {
|
|
|
+ searcher.buildIndex()
|
|
|
+ .then((data) => {
|
|
|
+ if (!data.errors) {
|
|
|
+ debug('Index created.');
|
|
|
+ }
|
|
|
+ return searcher.addAllPages();
|
|
|
+ });
|
|
|
+ }
|
|
|
|
|
|
return next();
|
|
|
};
|