lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jean-Francois Beaulac <>
Subject ConstantScoreQuery and MatchAllDocsQuery
Date Thu, 22 Feb 2007 23:20:50 GMT


What are those classes for?


I ask this because I need to return the frequency of the search terms with each of my results,
I tried using the TermFreqVector
object but unfortunately it was not fast enough, so I decided to modifiy lucene to be able
to return the frequency the same way the
score is returned by


I started by adding public abstract int freq(); in package
abstract class, and then modified every
implementation of  Scorer to be able to get the frequency.


Then I added a new field in named freq, and changed the constructor
so I give it the frequency when
it is created.


Finally I added a freq(int n) method to which acts exactly as
score(int n) but returns the frequency


It works well and fast, the only problem I have is that I did not find a way to compute the
frequency in both and internal scorers.


I just want to know if returning -1 or a java.lang.UnsupportedOperationException when the
freq() method is called is a bad idea ;P



Thank you



Jean-Francois Beaulac

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message