API การค้นหาที่คาดการณ์ได้ซึ่งช่วยให้คุณมีอิสระในการค้นหารายการหลายล้านรายการในฐานข้อมูลได้อย่างง่ายดาย การรวมกันของการค้นหาข้อความเต็มการจัดอันดับและการหยุดยั้งเพื่อให้คุณได้รับผลลัพธ์ที่ดีที่สุดสำหรับแอปพลิเคชัน/แอปพลิเคชัน Android ของคุณโดยใช้ SQLite3
ลิงค์แอพ
การค้นหาการทำนายคืออะไร?
นอกเหนือจากการค้นหาที่รวดเร็วด้วยการจับคู่สิ่งที่ทำนายได้คือสิ่งที่ทำไว้แล้วคำค้นหาของคุณคือคำค้นหาของคุณเช่น รับรูทจากนั้นค้นหาบนตาราง 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.
String DBTOBESERCHED ชื่อของฐานข้อมูลที่มีตารางที่คุณต้องการค้นหาอย่างชาญฉลาด
String TableOfData ชื่อของตารางที่มีข้อมูล
arraylist คอลัมน์ชื่อรายการของคอลัมน์ทั้งหมดในตารางด้านบน
2. ftsrebuilder ()
Rebulids the FTS Virtual Table. Run this each time you make changes to your main database.
3. getMatchesWostemming (สตริงพาร์ทิร์คำ)
returns the list of the words that match with your query. This is without stemming search.
4. String getMatchesWstemming (สตริงคำ)
Performs everything that getSearchList() does but with stemming. Use it for prediction.