lucene-java-user mailing list archives

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

 

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 org.apache.lucene.search.Hits.

 

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

 

Then I added a new field in org.apache.lucene.search.HitDoc 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 org.apache.lucene.search.Hits which acts exactly as
score(int n) but returns the frequency
instead.

 

It works well and fast, the only problem I have is that I did not find a way to compute the
frequency in both
ConstantScoreQuery.java and MatchAllDocsQuery.java 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


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