mirror of
https://github.com/finos/SymphonyElectron.git
synced 2024-12-27 01:11:13 -06:00
Testing for windows
This commit is contained in:
parent
4f0236b3ff
commit
c76397f601
@ -10,21 +10,24 @@
|
||||
padding: 5px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.hidden {
|
||||
display: none;
|
||||
}
|
||||
|
||||
input {
|
||||
padding: 5px;
|
||||
margin: 2px 0;
|
||||
border: 1px solid #ccc;
|
||||
}
|
||||
|
||||
label {
|
||||
padding-right: 10px;
|
||||
}
|
||||
|
||||
button {
|
||||
padding: 10px;
|
||||
background-color: rgba(0,64,98,0.7);
|
||||
background-color: rgba(0, 64, 98, 0.7);
|
||||
color: white;
|
||||
}
|
||||
</style>
|
||||
@ -85,7 +88,7 @@
|
||||
</div>
|
||||
</body>
|
||||
<script>
|
||||
var search = new ssf.Search("akon");
|
||||
var search = new ssf.Search("testUser1");
|
||||
var buttonEl = document.getElementById('search');
|
||||
var merge = document.getElementById('merge');
|
||||
var buttonIndex = document.getElementById('index')
|
||||
@ -145,7 +148,6 @@
|
||||
tr.appendChild(t3);
|
||||
table.appendChild(tr);
|
||||
});
|
||||
/*search.freeResults(JSON.stringify(out));*/
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -3,6 +3,13 @@
|
||||
const fs = require('fs');
|
||||
const randomString = require('randomstring');
|
||||
|
||||
|
||||
const electron = require('electron');
|
||||
const app = electron.app;
|
||||
const path = require('path');
|
||||
const isDevEnv = require('../utils/misc.js').isDevEnv;
|
||||
const isMac = require('../utils/misc.js').isMac;
|
||||
|
||||
const libSymphonySearch = require('./searchLibrary');
|
||||
const TEMP_BATCH_INDEX_FOLDER = './data/temp_batch_indexes';
|
||||
const TEMP_REALTIME_INDEX = './data/temp_realtime_index';
|
||||
@ -17,11 +24,12 @@ const SORT_BY_SCORE = 0;
|
||||
|
||||
const BATCH_RANDOM_INDEX_PATH_LENGTH = 20;
|
||||
|
||||
let execPath = path.dirname(app.getPath('exe'));
|
||||
|
||||
class Search {
|
||||
|
||||
constructor(userId) {
|
||||
this.isInitialized = false;
|
||||
this.messageData = [];
|
||||
this.userId = userId;
|
||||
this.startIndexingFromDate = (new Date().getTime() - SEARCH_PERIOD_SUBTRACTOR).toString();
|
||||
this.indexFolderName = INDEX_PREFIX + '_' + userId + '_' + INDEX_VERSION;
|
||||
@ -76,15 +84,18 @@ class Search {
|
||||
});
|
||||
}
|
||||
|
||||
/*eslint-disable class-methods-use-this */
|
||||
readJson() {
|
||||
return new Promise((resolve, reject) => {
|
||||
var files = fs.readdirSync('./msgsjson');
|
||||
this.messageData = [];
|
||||
let dirPath = path.join(execPath, isMac ? '..' : '', 'Resources/msgsjson');
|
||||
let messageFolderPath = isDevEnv ? './msgsjson/' : dirPath;
|
||||
let files = fs.readdirSync(messageFolderPath);
|
||||
let messageData = [];
|
||||
files.forEach(function (file) {
|
||||
let data = fs.readFileSync('./msgsjson/' + file, "utf8");
|
||||
let data = fs.readFileSync(messageFolderPath + file, "utf8");
|
||||
if (data) {
|
||||
this.messageData.push(JSON.parse(data));
|
||||
resolve(this.messageData);
|
||||
messageData.push(JSON.parse(data));
|
||||
resolve(messageData);
|
||||
} else {
|
||||
reject("err on reading files")
|
||||
}
|
||||
@ -133,6 +144,9 @@ class Search {
|
||||
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) {
|
||||
libSymphonySearch.symSEFreeResultAsync(returnedResult);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -3,10 +3,20 @@
|
||||
const ffi = require('ffi');
|
||||
const ref = require('ref');
|
||||
|
||||
const electron = require('electron');
|
||||
const app = electron.app;
|
||||
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 execPath = path.dirname(app.getPath('exe'));
|
||||
let libraryPath = isMac ? 'Resources/libsymphonysearch' : 'Resources/libsymphonysearchwin64';
|
||||
let fullPath = path.join(execPath, isMac ? '..' : '', libraryPath);
|
||||
let libPath = isDevEnv ? 'libsymphonysearch.dylib' : fullPath;
|
||||
|
||||
var libSymphonySearch = ffi.Library('libsymphonysearch', {
|
||||
var libSymphonySearch = ffi.Library(libPath, {
|
||||
//init
|
||||
'symSE_init': ['void', []],
|
||||
'symSE_remove_folder': ['int', ['string']],
|
||||
|
@ -33,6 +33,7 @@
|
||||
"!installer/*",
|
||||
"!tests/*"
|
||||
],
|
||||
"extraResources": ["msgsjson", "libsymphonysearch.dylib", "libsymphonysearchwin64.dll"],
|
||||
"extraFiles": "config/Symphony.config",
|
||||
"appId": "symphony-electron-desktop",
|
||||
"mac": {
|
||||
|
Loading…
Reference in New Issue
Block a user