1
0
mirror of https://github.com/nextapps-de/flexsearch.git synced 2025-09-25 04:51:29 +02:00

feat: return a promise for exportDocument function

This commit is contained in:
Andrew Lee
2021-07-29 16:15:55 -04:00
committed by Thomas Wilkerling
parent c2df6c9671
commit 28846f65a4

View File

@@ -134,15 +134,17 @@ export function exportDocument(callback, self, field, index_doc, index){
self = this;
setTimeout(function(){
return new Promise(async function(resolve){
if(!idx.export(callback, self, index ? field.replace(":", "-") : "", index_doc, index++)){
if(!(await idx.export(callback, self, index ? field.replace(":", "-") : "", index_doc, index++))){
index_doc++;
index = 1;
self.export(callback, self, field, index_doc, index);
await self.export(callback, self, field, index_doc, index);
}
resolve(true);
});
}
else{
@@ -171,10 +173,10 @@ export function exportDocument(callback, self, field, index_doc, index){
default:
return;
return Promise.resolve(true);
}
async(callback, this, key, index_doc, index, data);
return lazyExport(callback, this, key, index_doc, index, data);
}
}