mirror of
https://github.com/finos/SymphonyElectron.git
synced 2025-02-25 18:55:29 -06:00
Fixed the pointer issue
Added query filter
This commit is contained in:
parent
15ba93bb57
commit
5f0a6cd211
@ -43,13 +43,13 @@
|
||||
</div>
|
||||
<br>
|
||||
<div>
|
||||
<label for="offset">Offset:</label><input id="offset" value="0" size=5>
|
||||
<label for="limit">Limit:</label><input id="limit" value="25" size=5>
|
||||
<label for="offset">Offset:</label><input id="offset" type="number" value="0" size=5>
|
||||
<label for="limit">Limit:</label><input id="limit" type="number" value="25" size=5>
|
||||
</div>
|
||||
<br>
|
||||
<div>
|
||||
<label for="start">Start:</label><input id="start" value="000" size=20>
|
||||
<label for="end">End:</label><input id="end" value="999" size=20>
|
||||
<label for="start">Start:</label><input id="start" type="date">
|
||||
<label for="end">End:</label><input id="end" type="date">
|
||||
</div>
|
||||
<br>
|
||||
<div>
|
||||
@ -65,10 +65,11 @@
|
||||
</div>
|
||||
<br>
|
||||
<div>
|
||||
<label for="var1">var1:</label><input id="var1" value="0" size=5>
|
||||
<label for="var1">var1:</label><input id="var1" type="number" value="0" size=5>
|
||||
</div>
|
||||
<div>
|
||||
<label for="realTimeIndexing">Real Time Indexing:</label><input placeholder="Pass array of messages:" id="realTimeIndexing">
|
||||
<label for="realTimeIndexing">Real Time Indexing:</label><input placeholder="Pass array of messages:"
|
||||
id="realTimeIndexing">
|
||||
<button id='sendMessage'>Send</button>
|
||||
</div>
|
||||
<br>
|
||||
@ -96,7 +97,7 @@
|
||||
var search = new ssf.Search("testUser1");
|
||||
var buttonEl = document.getElementById('search');
|
||||
var merge = document.getElementById('merge');
|
||||
var buttonIndex = document.getElementById('index')
|
||||
var buttonIndex = document.getElementById('index');
|
||||
var queryEl = document.getElementById('query');
|
||||
var offsetEl = document.getElementById('offset');
|
||||
var limitEl = document.getElementById('limit');
|
||||
@ -128,13 +129,13 @@
|
||||
if (!search.isLibInit()) {
|
||||
alert('Library is not initiated. Init first...');
|
||||
return;
|
||||
}/*
|
||||
while (a < 100000){
|
||||
a++*/
|
||||
}
|
||||
//while (a < 100000){
|
||||
// a++;
|
||||
let out;
|
||||
table.innerHTML = '';
|
||||
table.classList.remove('hidden');
|
||||
search.query(queryEl.value, offsetEl.value, limitEl.value, startEl.value, endEl.value, senderIdEl.value, threadIdEl.value).then(function (result) {
|
||||
search.query(queryEl.value, senderIdEl.value, threadIdEl.value, null, startEl.value, endEl.value, limitEl.value, offsetEl.value, 0).then(function (result) {
|
||||
out = result;
|
||||
var th = document.createElement('tr');
|
||||
var th1 = document.createElement('td');
|
||||
@ -160,8 +161,10 @@
|
||||
tr.appendChild(t3);
|
||||
table.appendChild(tr);
|
||||
});
|
||||
}).catch(function (err) {
|
||||
resultsEl.innerHTML = err;
|
||||
});
|
||||
/*}*/
|
||||
//}
|
||||
});
|
||||
|
||||
sendMessage.addEventListener('click', function () {
|
||||
|
@ -132,41 +132,52 @@ class Search {
|
||||
}
|
||||
|
||||
let sd = new Date().getTime() - SEARCH_PERIOD_SUBTRACTOR;
|
||||
if (!isNaN(startDate)) {
|
||||
if (startDate >= sd) {
|
||||
sd = startDate;
|
||||
let sd_time = MINIMUM_DATE;
|
||||
if (startDate && startDate !== "" && typeof startDate === 'object'){
|
||||
sd_time = new Date(startDate).getTime();
|
||||
if (sd_time >= sd) {
|
||||
sd_time = sd;
|
||||
}
|
||||
}
|
||||
|
||||
let sd_str = sd.toString();
|
||||
let ed_str = MAXIMUM_DATE;
|
||||
if (!isNaN(endDate)) {
|
||||
ed_str = endDate.toString();
|
||||
let ed_time = MAXIMUM_DATE;
|
||||
if (endDate && endDate !== "" && typeof endDate === 'object'){
|
||||
ed_time = new Date(endDate).getTime();
|
||||
}
|
||||
|
||||
/*eslint-disable no-param-reassign */
|
||||
if (isNaN(limit)) {
|
||||
if (!limit && limit === "" && typeof limit !== 'number' && Math.round(limit) !== limit) {
|
||||
limit = 25;
|
||||
}
|
||||
|
||||
if (isNaN(offset)) {
|
||||
if (!offset && offset === "" && typeof offset !== 'number' && Math.round(offset) !== offset) {
|
||||
offset = 0
|
||||
}
|
||||
|
||||
if (isNaN(sortOrder)) {
|
||||
if (!sortOrder && sortOrder === "" && typeof sortOrder !== 'number' && Math.round(sortOrder) !== sortOrder) {
|
||||
sortOrder = SORT_BY_SCORE;
|
||||
}
|
||||
|
||||
let returnedResult = libSymphonySearch.symSESearch(this.indexFolderName, TEMP_REALTIME_INDEX, q, sd_str, ed_str, offset, limit, sortOrder);
|
||||
let ret = JSON.parse(returnedResult);
|
||||
resolve(ret);
|
||||
if (ret.messages.length > 0) {
|
||||
const returnedResult = libSymphonySearch.symSESearch(this.indexFolderName, TEMP_REALTIME_INDEX, q, sd_time.toString(), ed_time.toString(), offset, limit, sortOrder);
|
||||
try {
|
||||
let ret = returnedResult.readCString();
|
||||
resolve(JSON.parse(ret));
|
||||
} finally {
|
||||
libSymphonySearch.symSEFreeResult(returnedResult);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
static constructQuery(query) {
|
||||
return query;
|
||||
static constructQuery(query, senderId, threadId) {
|
||||
let q = query;
|
||||
if(senderId && senderId !== "") {
|
||||
q += ` AND (senderId: ${senderId})`;
|
||||
}
|
||||
if(threadId && threadId !== "") {
|
||||
q += ` AND (threadId: ${threadId})`;
|
||||
}
|
||||
console.log(q)
|
||||
return q;
|
||||
}
|
||||
|
||||
static indexValidator(file) {
|
||||
@ -179,7 +190,7 @@ class Search {
|
||||
}
|
||||
return new Error('Unable validate index folder')
|
||||
} catch (err) {
|
||||
throw (err)
|
||||
throw (err);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9,13 +9,10 @@ const path = require('path');
|
||||
const isDevEnv = require('../utils/misc.js').isDevEnv;
|
||||
const isMac = require('../utils/misc.js').isMac;
|
||||
|
||||
var symLucyIndexer = ref.types.void;
|
||||
var symLucyIndexerPtr = ref.refType(symLucyIndexer);
|
||||
let symLucyIndexer = ref.types.void;
|
||||
let symLucyIndexerPtr = ref.refType(symLucyIndexer);
|
||||
|
||||
|
||||
let messageData = ref.types.void;
|
||||
let messagePtr = ref.refType(messageData);
|
||||
|
||||
let execPath = path.dirname(app.getPath('exe'));
|
||||
|
||||
const rootPath = isMac ? 'libsymphonysearch.dylib' : 'libsymphonysearch.dll';
|
||||
@ -23,7 +20,7 @@ let productionPath = path.join(execPath, isMac ? '..' : '', rootPath);
|
||||
let devPath = path.join(__dirname, '..', '..', rootPath);
|
||||
let libraryPath = isDevEnv ? devPath : productionPath;
|
||||
|
||||
var libSymphonySearch = ffi.Library(libraryPath, {
|
||||
let libSymphonySearch = ffi.Library(libraryPath, {
|
||||
//init
|
||||
'symSE_init': ['void', []],
|
||||
'symSE_remove_folder': ['int', ['string']],
|
||||
@ -38,13 +35,13 @@ var libSymphonySearch = ffi.Library(libraryPath, {
|
||||
'symSE_merge_temp_index': ['int', ['string', 'string']],
|
||||
'symSE_clear_temp_index': ['int', ['string']],
|
||||
//Search,
|
||||
'symSE_search': ['string', ['string', 'string', 'string', 'string', 'string', 'int', 'int', 'int']],
|
||||
'symSE_search': ['char *', ['string', 'string', 'string', 'string', 'string', 'int', 'int', 'int']],
|
||||
//Deletion
|
||||
'symSE_delete_messages': ['int', ['string', 'string', 'string', 'string']],
|
||||
//Index commit/optimize
|
||||
'symSE_commit_index': ['int', [symLucyIndexerPtr, 'int']], //will be removed
|
||||
//freePointer
|
||||
'symSE_free_results': ['int', [messagePtr]]
|
||||
'symSE_free_results': ['int', ['char *']]
|
||||
});
|
||||
|
||||
module.exports = {
|
||||
|
@ -33,11 +33,10 @@
|
||||
"!installer/*",
|
||||
"!tests/*"
|
||||
],
|
||||
"extraFiles": ["config/Symphony.config","msgsjson",
|
||||
"extraFiles": ["config/Symphony.config",
|
||||
"msgsjson",
|
||||
"libsymphonysearch.dylib",
|
||||
"indexvalidator.exe",
|
||||
"indexvalidator.exec",
|
||||
"libsymphonysearch.dll"],
|
||||
"indexvalidator.exec"],
|
||||
"appId": "symphony-electron-desktop",
|
||||
"mac": {
|
||||
"target": "dmg",
|
||||
|
Loading…
Reference in New Issue
Block a user