lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Elschot <>
Subject Re: Boolean query term match count
Date Thu, 25 May 2006 21:05:10 GMT
On Thursday 25 May 2006 21:08, Crump, Michael wrote:
> Hello,
> I'm working on a search application and I need to know if it is possible
> to get the number of terms that actually matched a Boolean query.  For
> example let's say I have field test with values aaa bbb ccc d e f and I
> constructed a Boolean query like this:  test:aaa OR test:bbb OR test:e
> is it possible to get the count - 3 for the the terms (aaa, bbb, e) that
> matched from the test field.  If not would it be possible to modify the
> BooleanScorer to accomplish this?

Have  a look at Similarity and DefaultSimilarity. It looks like
you need your own Similarity with a non constant coord()
implementation, and some constant value for the rest of the
methods in there.
The first argument to coord() is the number of matching
clauses for a document for a boolean query.
The value returned by coord() will be used in the calculation
of the score value for the document.

Paul Elschot

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message