Smart Search
Smart-Search
一種預測性搜索API,可自由地自由搜索數據庫中數百萬個條目。全文搜索,排名和Stem的組合,為您使用SQLITE 3提供了Android應用程序/應用程序的最佳輸出。
應用鏈接
什麼是預測性搜索?
除了快速搜索與匹配的子字符串的快速搜索外,預測性的作用是,它的詞幹是您的搜索單詞,即。獲取根,然後在FTS表上搜索以獲取匹配列表,然後根據匹配的概率和返回排序列表對列表進行分類。
如何使用
在您的構建文件中添加以下內容。
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
dependencies {
compile 'com.github.gauravat16:Smart-Search:1.2'
}
例子
PredictiveSearch search = new PredictiveSearch(getApplicationContext());
ArrayList<String> columns = new ArrayList<>();
columns.add("<column-name>");
columns.add("<column-name>");
try {
search.createFTS4Table("<db-name.db>", "<table-name>", columns);
search.ftsRebuilder(); //Use it to rebulid after any change
ArrayList<String> resp1 = search.getSearchList("potatoes"); //Get result w/o stemming
ArrayList<String> resp2 = search.getPredictedList("try"); //Get result with stemming - predictive
} catch (Exception ex) {
ex.printStackTrace();
} finally {
search.close();
}
1。 createfts4table(字符串dbtobesearched,字符串tableofdata,arrayList columnNames)
Creates/Builds the Full Text Search Virtual Table.
字符串dbtobesearch搜索具有您要智能搜索表的數據庫的名稱。
字符串tableofdata包含數據的表的名稱。
ArrayList列名稱上表中的所有列的列表。
2。 ftsrebuilder()
Rebulids the FTS Virtual Table. Run this each time you make changes to your main database.
3。 getMatchesWostemming(字符串partword)
returns the list of the words that match with your query. This is without stemming search.
4。字符串getMatcheswstemming(字符串字)
Performs everything that getSearchList() does but with stemming. Use it for prediction.