You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Lothar Simon <lo...@eidon.de> on 2002/06/20 17:50:17 UTC

Determine number of entries for a certain key

What is the easiest way to determine the number of (not deleted) terms in an
(not optimized) index when the KEY string is known? Each indexed document
has a KEY and a CONTENTS field. One of my approaches was:

    Searcher searcher = new IndexSearcher(this.indexworkdir);
    Query query = QueryParser.parse(key, FULLTEXT_KEY_FIELD, analyzer);
    int count = searcher.search(query).length();
    searcher.close();

This does not find anything: for existing keys always count=0 (though
searches in the CONTENTS field work perfectly). In addition, I tried
IndexReader and TermDocs, then IndexReader and docFreq... No success.



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>