SEARCH-155

Index real-time data.

- Read messages from data feed
- Index the messages in real-time index.
This commit is contained in:
Keerthi Niranjan 2017-09-05 17:21:23 +05:30
parent 59505ed93d
commit 652a3389f3
2 changed files with 5 additions and 3 deletions

View File

@ -6,6 +6,7 @@ const electron = require('electron');
const childProcess = require('child_process');
const app = electron.app;
const path = require('path');
const isObject = require('lodash.isplainobject');
const isDevEnv = require('../utils/misc.js').isDevEnv;
const isMac = require('../utils/misc.js').isMac;
@ -151,15 +152,15 @@ class Search {
* @param message
*/
realTimeIndexing(message) {
if (!Array.isArray(message)) {
return new Error('Messages should be an array');
if (!message && !isObject(JSON.parse(message))) {
return new Error('Messages must be an object');
}
if (!this.isInitialized) {
return new Error('Library not initialized');
}
let result = libSymphonySearch.symSEIndexRealTime(this.realTimeIndex, JSON.stringify(message));
let result = libSymphonySearch.symSEIndexRealTime(this.realTimeIndex, [ message ]);
return result === 0 ? "Successful" : result
}

View File

@ -109,6 +109,7 @@
"ffi": "^2.2.0",
"filesize": "^3.5.10",
"keymirror": "0.1.1",
"lodash.isplainobject": "^4.0.6",
"node-forge": "^0.7.1",
"randomstring": "^1.1.5",
"ref": "^1.3.4",