SymphonyElectron/js/search/searchLibrary.js
Vikas Shashidhar 3cf9226bf4 Revert "Merge pull request #269 from keerthi16/skynet"
This reverts commit 1388c835ef, reversing
changes made to c9d6229d6d.
2017-12-28 17:29:27 +05:30

73 lines
3.6 KiB
JavaScript

'use strict';
const ffi = require('ffi');
const ref = require('ref');
const searchConfig = require('../search/searchConfig.js');
const symLucyIndexer = ref.types.void;
const symLucyIndexerPtr = ref.refType(symLucyIndexer);
/**
* Initializing the C SymphonySearchEngine library
* using the node-ffi
*/
let libSymphonySearch = ffi.Library(searchConfig.LIBRARY_CONSTANTS.SEARCH_LIBRARY_PATH, {
//init
'symSE_init': ['void', []],
'symSE_remove_folder': ['int', ['string']],
'symSE_ensure_index_exists': ['int', ['string']],
'symSE_ensure_folder_exists': ['int', ['string']],
//first time indexing and delta indexing
'symSE_get_indexer': [symLucyIndexerPtr, ['string']], //will be removed
'symSE_create_partial_index': ['int', ['string', 'string', 'string']],
'symSE_merge_partial_index': ['int', ['string', 'string']],
//real time indexing
'symSE_index_realtime': ['int', ['string', 'string']],
'symSE_merge_temp_index': ['int', ['string', 'string']],
'symSE_clear_temp_index': ['int', ['string']],
//Search,
'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', ['char *']],
//Latest messages timestamp
'symSE_get_last_message_timestamp': ['char *', ['string']]
});
module.exports = {
symSEInit: libSymphonySearch.symSE_init,
symSERemoveFolder: libSymphonySearch.symSE_remove_folder,
symSEEnsureIndexExists: libSymphonySearch.symSE_ensure_index_exists,
symSEEnsureFolderExists: libSymphonySearch.symSE_ensure_folder_exists,
symSEGetIndexer: libSymphonySearch.symSE_get_indexer,
symSECreatePartialIndex: libSymphonySearch.symSE_create_partial_index,
symSEMergePartialIndex: libSymphonySearch.symSE_merge_partial_index,
symSEIndexRealTime: libSymphonySearch.symSE_index_realtime,
symSEMergeTempIndex: libSymphonySearch.symSE_merge_temp_index,
symSEClearTempIndex: libSymphonySearch.symSE_clear_temp_index,
symSESearch: libSymphonySearch.symSE_search,
symSEDeleteMessages: libSymphonySearch.symSE_delete_messages,
symSECommitIndex: libSymphonySearch.symSE_commit_index,
symSEFreeResult: libSymphonySearch.symSE_free_results,
symSEGetLastMessageTimestamp: libSymphonySearch.symSE_get_last_message_timestamp,
symSEInitAsync: libSymphonySearch.symSE_init.async,
symSERemoveFolderAsync: libSymphonySearch.symSE_remove_folder.async,
symSEEnsureIndexExistsAsync: libSymphonySearch.symSE_ensure_index_exists.async,
symSEEnsureFolderExistsAsync: libSymphonySearch.symSE_ensure_folder_exists.async,
symSEGetIndexerAsync: libSymphonySearch.symSE_get_indexer.async,
symSECreatePartialIndexAsync: libSymphonySearch.symSE_create_partial_index.async,
symSEMergePartialIndexAsync: libSymphonySearch.symSE_merge_partial_index.async,
symSEIndexRealTimeAsync: libSymphonySearch.symSE_index_realtime.async,
symSEMergeTempIndexAsync: libSymphonySearch.symSE_merge_temp_index.async,
symSEClearTempIndexAsync: libSymphonySearch.symSE_clear_temp_index.async,
symSESearchAsync: libSymphonySearch.symSE_search.async,
symSEDeleteMessagesAsync: libSymphonySearch.symSE_delete_messages.async,
symSECommitIndexAsync: libSymphonySearch.symSE_commit_index.async,
symSEFreeResultAsync: libSymphonySearch.symSE_free_results.async,
symSEGetLastMessageTimestampAsync: libSymphonySearch.symSE_get_last_message_timestamp.async
};