找到給出的單詞數在Lucene的(http://www.lucenetutorial.com/lucene-in-5-minutes.html)的教程,在Java中的Lucene庫
public class HelloLucene {
public static void main(String[] args) throws IOException, ParseException {
IndexWriter w = new IndexWriter(index, config);
addDoc(w, "Lucene lucene in Action");
addDoc(w, "Lucene for Dummies");
addDoc(w, "Managing Gigabytes");
addDoc(w, "The Art of Computer Science");
w.close();
String querystr = args.length > 0 ? args[0] : "lucene";
//...
}
}
當我改變字符串上面所指示的那樣「的Lucene的Lucene在行動」,然後搜索關鍵字的文檔「lucene」,它找到字符串「Lucene lucene in Action」的匹配數1。我想發送一個字符串(例如「asd asd fds asd」)來運行並搜索「asd」並找到結果3.我怎樣才能通過使用查詢addDoc(w,「asd asd fds asd」); ???
它沒有給出所選行中的命中數。如果有擊中或命中,它會寫入1,如果沒有,則寫入0。