SEARCH-154 & SEARCH-116

1. Serialized the messages array from the client app
This commit is contained in:
Keerthi Niranjan 2017-08-28 14:18:48 +05:30 committed by Keerthi Niranjan
parent c8b45e091e
commit 59505ed93d

View File

@ -109,7 +109,7 @@ class Search {
*/ */
indexBatch(messages) { indexBatch(messages) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
if (!Array.isArray(messages)) { if (!messages && !(JSON.parse(messages) instanceof Array)) {
reject(new Error('Messages must be an array')); reject(new Error('Messages must be an array'));
return; return;
} }
@ -120,7 +120,7 @@ class Search {
} }
const indexId = randomString.generate(BATCH_RANDOM_INDEX_PATH_LENGTH); const indexId = randomString.generate(BATCH_RANDOM_INDEX_PATH_LENGTH);
libSymphonySearch.symSECreatePartialIndexAsync(this.batchIndex, indexId, JSON.stringify(messages), (err, res) => { libSymphonySearch.symSECreatePartialIndexAsync(this.batchIndex, indexId, messages, (err, res) => {
if (err) { if (err) {
reject(new Error(err)); reject(new Error(err));
} }