Query q = parser.parse(query);
//Checked;System.out.println(q);
TopDocs hits = searcher.search(q,numResultsToReturn);
int test = hits.totalHits;
System.out.println(test);
The test give result = zero. What may cause this?
Problem sloved. I use Stringfield instead of "textfield" to be searched. Should textfield. It is designed for key wordsearch.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.