简体   繁体   中英

Lucene: Topdocs index search return zero

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?

  1. I believe I set up correct path for indexsearcher.
  2. I think I already create the correct index files.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM