I think you could override all the Similarity factors except tf() with 1, such that the term frequency is the only factor in the scoring. Then you just submit the term as a query. Note, I think you will need to override the similarity during indexing, too, so that norm length is turned off, too. Note, I haven't tried it :-). Use the explain() functionality to double check. At any rate, it should be quick to test.

See 
http://lucene.apache.org/java/2_3_2/api/org/apache/lucene/search/Similarity.html

-Grant


On May 28, 2008, at 10:48 AM, Hider, Sandy wrote:

Hi All,
I am trying to figure out a quick way to find the top N documents sorted
by frequency of a term.

I found:

IndexRead.termDocs()

which provides an enumeration of doc() and freq() but it returns an
enumeration sorted by doc number.   Is there a way to get the results
sorted by freq?  Or is there another query I can run the find these
results?

Thanks in advance,

Sandy


--------------------------
Grant Ingersoll
http://www.lucidimagination.com

Lucene Helpful Hints:
http://wiki.apache.org/lucene-java/BasicsOfPerformance
http://wiki.apache.org/lucene-java/LuceneFAQ








---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to