Browse Source

refactor buildIndex -> rebuildIndex

Yuki Takei 6 years ago
parent
commit
d9b23e4158

+ 1 - 1
src/server/routes/apiv3/search.js

@@ -94,7 +94,7 @@ module.exports = (crowi) => {
           return res.status(200).send({ message: 'Operation is successfully processed.' });
         case 'rebuild':
           // NOT wait the processing is terminated
-          search.buildIndex();
+          search.rebuildIndex();
           return res.status(200).send({ message: 'Operation is successfully requested.' });
         default:
           throw new Error(`Unimplemented operation: ${operation}`);

+ 1 - 1
src/server/routes/installer.js

@@ -17,7 +17,7 @@ module.exports = function(crowi, app) {
       return;
     }
 
-    await search.buildIndex();
+    await search.rebuildIndex();
   }
 
   async function createInitialPages(owner, lang) {

+ 3 - 3
src/server/service/search-delegator/elasticsearch.js

@@ -149,9 +149,9 @@ class ElasticsearchDelegator {
   }
 
   /**
-   * build index
+   * rebuild index
    */
-  async buildIndex() {
+  async rebuildIndex() {
     const { client, indexName, aliasName } = this;
 
     const tmpIndexName = `${indexName}-tmp`;
@@ -185,7 +185,7 @@ class ElasticsearchDelegator {
       await this.addAllPages();
     }
     catch (err) {
-      logger.warn('An error occured while \'buildIndex\', normalize indices anyway.');
+      logger.warn('An error occured while \'rebuildIndex\', normalize indices anyway.');
       throw err;
     }
     finally {

+ 1 - 1
src/server/service/search-delegator/searchbox.js

@@ -25,7 +25,7 @@ class SearchboxDelegator extends ElasticsearchDelegator {
   /**
    * @inheritdoc
    */
-  async buildIndex() {
+  async rebuildIndex() {
     const { client, indexName, aliasName } = this;
 
     // flush index

+ 2 - 2
src/server/service/search.js

@@ -76,8 +76,8 @@ class SearchService {
     return this.delegator.normalizeIndices();
   }
 
-  async buildIndex() {
-    return this.delegator.buildIndex();
+  async rebuildIndex() {
+    return this.delegator.rebuildIndex();
   }
 
   async searchKeyword(keyword, user, userGroups, searchOpts) {