Mailing List Archive

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: <mailto:lucene-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:lucene-user-help@jakarta.apache.org>