lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Elschot <>
Subject Re: Coord Score: Ignoring Coord for a Specific BooleanClause within a BooleanQuery?
Date Thu, 27 Jan 2011 20:33:10 GMT
On Thursday 27 January 2011 00:21:22 Tavi Nathanson wrote:
> Hey everyone,
> Aside from simply disabling coord for an entire query, I was wondering if
> there was a good way to disable coord for a BooleanClause within a query
> such that the max coord value, and the overlap value, simply ignore that
> clause?
> For example, I have the following query:
> (apple OR banana OR orange OR ("apple banana" OR "banana orange"))
> I'd like to modify the coord score of the above query such that the *entire*
> query will be multiplied by 2/3 if "apple" and "banana" are matched.
> Currently, it'll be multiplied by 2/4 or 3/4, depending on whether the final
> clause (the two phrases) are matched.
> (Another option is to turn the query into ((apple OR banana OR orange) OR
> ("apple banana" OR "banana orange")): this will result in the right number,
> 2/3; however, it'll only be multiplied to the left clause, and I want it
> multiplied by the entire query.)
> If I were to hack this together, I would go into BooleanClause and add an
> isIgnoringCoord() for each clause. Then, in BooleanScorer2, I would modify
> the logic such that maxCoord and nrMatchers don't consider any BooleanClause
> with such a flag. But I figure there must be a better way :)

It would be easier to make a DisjunctionSumQuery that scores by using
DisjunctionSumScorer. The weighting between this Query and Scorer could
simply do nothing except for passing things to the scorer, or ma ybe
normalize just like BooleanQuery.
Then use that as the top level for the second form of the query above.

Have fun,
Paul Elschot

> Any ideas would be much appreciated!
> Tavi
> -- 
> View this message in context:
> Sent from the Solr - Dev mailing list archive at
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

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

View raw message