diff --git a/ReactNativeClient/lib/components/screens/search.js b/ReactNativeClient/lib/components/screens/search.js index e90d4f2ec..49f208c5e 100644 --- a/ReactNativeClient/lib/components/screens/search.js +++ b/ReactNativeClient/lib/components/screens/search.js @@ -11,6 +11,7 @@ const { BaseScreenComponent } = require('lib/components/base-screen.js'); const { themeStyle } = require('lib/components/global-style.js'); const DialogBox = require('react-native-dialogbox').default; const SearchEngineUtils = require('lib/services/searchengine/SearchEngineUtils'); +const SearchEngine = require('lib/services/searchengine/SearchEngine'); Icon.loadFont(); @@ -72,18 +73,6 @@ class SearchScreenComponent extends BaseScreenComponent { this.isMounted_ = false; } - // UNSAFE_componentWillReceiveProps(newProps) { - // console.info('UNSAFE_componentWillReceiveProps', newProps); - - // let newState = {}; - // if ('query' in newProps && !this.state.query) newState.query = newProps.query; - - // if (Object.getOwnPropertyNames(newState).length) { - // this.setState(newState); - // this.refreshSearch(newState.query); - // } - // } - searchTextInput_submit() { const query = this.state.query.trim(); if (!query) return; @@ -134,6 +123,14 @@ class SearchScreenComponent extends BaseScreenComponent { if (!this.isMounted_) return; + const parsedQuery = await SearchEngine.instance().parseQuery(query); + const highlightedWords = SearchEngine.instance().allParsedQueryTerms(parsedQuery); + + this.props.dispatch({ + type: 'SET_HIGHLIGHTED', + words: highlightedWords, + }); + this.setState({ notes: notes }); } diff --git a/ReactNativeClient/lib/database.js b/ReactNativeClient/lib/database.js index 32d9db6cc..b7d7adfbb 100644 --- a/ReactNativeClient/lib/database.js +++ b/ReactNativeClient/lib/database.js @@ -121,14 +121,16 @@ class Database { return this.tryCall('selectOne', sql, params); } - async loadExtension(path) { - let result = null; - try { - result = await this.driver().loadExtension(path); - return result; - } catch (e) { - throw new Error(`Could not load extension ${path}`); - } + async loadExtension(/* path */) { + return; // Disabled for now as fuzzy search extension is not in use + + // let result = null; + // try { + // result = await this.driver().loadExtension(path); + // return result; + // } catch (e) { + // throw new Error(`Could not load extension ${path}`); + // } } async selectAll(sql, params = null) {