Coord Score: Ignoring Coord for a Specific BooleanClause within a BooleanQuery?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Coord Score: Ignoring Coord for a Specific BooleanClause within a BooleanQuery?

Tavi Nathanson

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 :)

Any ideas would be much appreciated!

Tavi
--
View this message in context: http://lucene.472066.n3.nabble.com/Coord-Score-Ignoring-Coord-for-a-Specific-BooleanClause-within-a-BooleanQuery-tp2358360p2358360.html
Sent from the Solr - Dev mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Coord Score: Ignoring Coord for a Specific BooleanClause within a BooleanQuery?

Paul Elschot
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: http://lucene.472066.n3.nabble.com/Coord-Score-Ignoring-Coord-for-a-Specific-BooleanClause-within-a-BooleanQuery-tp2358360p2358360.html
> Sent from the Solr - Dev mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Coord Score: Ignoring Coord for a Specific BooleanClause within a BooleanQuery?

Paul Elschot
On Thursday 27 January 2011 21:33:10 Paul Elschot wrote:

> 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.

Perhaps even better to that as the top level for this form:

 (apple OR banana OR orange) OR "apple banana" OR "banana orange"


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]