Yuki Takei 6 лет назад
Родитель
Сommit
3cd6389d43
2 измененных файлов с 11 добавлено и 29 удалено
  1. 11 21
      src/server/service/search-delegator/elasticsearch.js
  2. 0 8
      src/server/service/search.js

+ 11 - 21
src/server/service/search-delegator/elasticsearch.js

@@ -73,6 +73,10 @@ class ElasticsearchDelegator {
     this.indexName = indexName;
   }
 
+  /**
+   * parse `this.esUri` and return information object to connect to ES
+   * @return {object} { host, httpAuth, indexName}
+   */
   parseUri() {
     let indexName = 'crowi';
     let host = this.esUri;
@@ -99,6 +103,9 @@ class ElasticsearchDelegator {
     return this.initIndices();
   }
 
+  /**
+   * build index
+   */
   async buildIndex() {
     const { client, indexName, aliasName } = this;
 
@@ -145,6 +152,9 @@ class ElasticsearchDelegator {
     await client.indices.delete({ index: tmpIndexName });
   }
 
+  /**
+   * retrieve elasticsearch node information
+   */
   async checkESVersion() {
     try {
       const nodes = await this.client.nodes.info();
@@ -162,7 +172,7 @@ class ElasticsearchDelegator {
       }
     }
     catch (error) {
-      logger.error('es check version error:', error);
+      logger.error('Couldn\'t check ES version:', error);
     }
   }
 
@@ -200,26 +210,6 @@ class ElasticsearchDelegator {
     return this.client.indices.create({ index, body });
   }
 
-  // SearchClient.prototype.buildIndexForSearchbox = async function() {
-  //   const { client, indexName, aliasName } = this;
-
-  //   // flush index
-  //   await client.indices.delete({
-  //     index: indexName,
-  //   });
-  //   await this.createIndex(indexName);
-  //   await this.addAllPages();
-
-  //   // update alias
-  //   await client.indices.updateAliases({
-  //     body: {
-  //       actions: [
-  //         { add: { alias: aliasName, index: indexName } },
-  //       ],
-  //     },
-  //   });
-  // };
-
   /**
    * generate object that is related to page.grant*
    */

+ 0 - 8
src/server/service/search.js

@@ -76,12 +76,4 @@ class SearchService {
 
 }
 
-
-// SearchClient.prototype.initClient = function() {
-//     host = isSearchboxSsl
-//       ? `${url.protocol}//${url.auth}${url.hostname}:443` // use 443 when Searchbox
-//       : `${url.protocol}//${url.host}`;
-// };
-
-
 module.exports = SearchService;