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 Gary Mangum <ga...@gmail.com> on 2006/01/15 06:48:52 UTC

Complete count of search results

I am trying to find out a quick way to get a complete count of all search
results found in all of my Documents.

Let me back up...

I have split the content that I am searching into many Documents and then
indexed this content.  Each Document represents about one "paragraph" of
data.

Now I search all of my Documents for a word or phrase.

If I understand correctly, the Hits that are returned tell me which
Documents contain the information that I am searching for.  And Hits.length()
would tell me how many documents contain my information.

I would like to know how many total results were found for my search.  In
other words, if a Document contains the word or phrase more than once, I
would like to know this information so that I can return a "true" count of
search results that were found across all of my Documents.  It seems that
Lucene must already know this information since it searched the Document
already when it scored and added it to my Hits.

What is the best way to get this information quickly?

Thanks,

Gary