SEARCH-535

- Using the Node.js to remove the index data folder
- SEARCH-501 fixed some linting issues
This commit is contained in:
Keerthi Niranjan 2017-12-08 14:34:07 +05:30
parent 23f1f1ed52
commit 38915ed5ad

View File

@ -71,8 +71,8 @@ class Search {
init() { init() {
libSymphonySearch.symSEInit(); libSymphonySearch.symSEInit();
libSymphonySearch.symSEEnsureFolderExists(this.dataFolder); libSymphonySearch.symSEEnsureFolderExists(this.dataFolder);
libSymphonySearch.symSERemoveFolder(this.realTimeIndex); Search.deleteFolderRecursive(this.realTimeIndex);
libSymphonySearch.symSERemoveFolder(this.batchIndex); Search.deleteFolderRecursive(this.batchIndex);
Search.indexValidator(this.indexFolderName); Search.indexValidator(this.indexFolderName);
Search.indexValidator(this.realTimeIndex); Search.indexValidator(this.realTimeIndex);
let indexDateStartFrom = new Date().getTime() - searchConfig.SEARCH_PERIOD_SUBTRACTOR; let indexDateStartFrom = new Date().getTime() - searchConfig.SEARCH_PERIOD_SUBTRACTOR;
@ -139,7 +139,7 @@ class Search {
reject(new Error(err)); reject(new Error(err));
return; return;
} }
libSymphonySearch.symSERemoveFolder(this.batchIndex); Search.deleteFolderRecursive(this.batchIndex);
resolve(res); resolve(res);
}); });
}); });
@ -493,12 +493,12 @@ class Search {
let i,j = 0; let i,j = 0;
let out = ""; let out = "";
for(i = tokens.length; i>0; i--) {// number of tokens in a tuple for(i = tokens.length; i > 0; i--) {// number of tokens in a tuple
for(j= 0; j < tokens.length-i+1 ; j++ ){ //start from index for(j = 0; j < tokens.length-i + 1 ; j++){ //start from index
if(out != ""){ if(out !== ""){
out += " "; out += " ";
} }
out += Search.putTokensInRange(tokens, j, i); out += Search.putTokensInRange(tokens, j, i);
} }
} }
return out; return out;
@ -514,10 +514,9 @@ class Search {
* @returns {String} * @returns {String}
*/ */
static putTokensInRange(tokens, start, numTokens) { static putTokensInRange(tokens, start, numTokens) {
let i=0;
let out = "\""; let out = "\"";
for(i=0; i< numTokens; i++) { for(let i = 0; i < numTokens; i++) {
if(i != 0) { if(i !== 0) {
out += " "; out += " ";
} }
out+= tokens[start+i]; out+= tokens[start+i];