SEARCH-535

- Renamed deleteFolderRecursive to deleteIndexFolders
This commit is contained in:
Keerthi Niranjan 2017-12-12 11:02:05 +05:30
parent 38915ed5ad
commit 831a9be446

View File

@ -71,8 +71,8 @@ class Search {
init() { init() {
libSymphonySearch.symSEInit(); libSymphonySearch.symSEInit();
libSymphonySearch.symSEEnsureFolderExists(this.dataFolder); libSymphonySearch.symSEEnsureFolderExists(this.dataFolder);
Search.deleteFolderRecursive(this.realTimeIndex); Search.deleteIndexFolders(this.realTimeIndex);
Search.deleteFolderRecursive(this.batchIndex); Search.deleteIndexFolders(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;
} }
Search.deleteFolderRecursive(this.batchIndex); Search.deleteIndexFolders(this.batchIndex);
resolve(res); resolve(res);
}); });
}); });
@ -549,12 +549,12 @@ class Search {
* Removing all the folders and files inside the data folder * Removing all the folders and files inside the data folder
* @param location * @param location
*/ */
static deleteFolderRecursive(location) { static deleteIndexFolders(location) {
if (fs.existsSync(location)) { if (fs.existsSync(location)) {
fs.readdirSync(location).forEach((file) => { fs.readdirSync(location).forEach((file) => {
let curPath = location + "/" + file; let curPath = location + "/" + file;
if (fs.lstatSync(curPath).isDirectory()) { if (fs.lstatSync(curPath).isDirectory()) {
Search.deleteFolderRecursive(curPath); Search.deleteIndexFolders(curPath);
} else { } else {
fs.unlinkSync(curPath); fs.unlinkSync(curPath);
} }
@ -570,7 +570,7 @@ class Search {
* when the app is closed/signed-out/navigates * when the app is closed/signed-out/navigates
*/ */
function deleteIndexFolder() { function deleteIndexFolder() {
Search.deleteFolderRecursive(searchConfig.FOLDERS_CONSTANTS.INDEX_PATH); Search.deleteIndexFolders(searchConfig.FOLDERS_CONSTANTS.INDEX_PATH);
} }
/** /**