Capping boost given by custom_filters_score


(Frederick Cheung) #1

I'm using custom_filters_score to boost documents that match one or
more filters. Documents matching more of those filters should receive
a larger boost, but only up to a point.

For example a document matching 1 filters might get a boost of 1.2,
one matching 2 filters a boost of 1.44 but a document matching 3
filters would be capped at 1.44 (rather than 1.2 *1.44).
I can't find anything that looks like it might do that but I'd love to
be proved wrong. Failing that would a custom_filters_score option
along the lines of max_boost be of interest ? If so pointers to where
to start digging in the source gratefully accepted!

Thanks,

Fred


(Shay Banon) #2

Heya, it definitely make sense, and should not be too difficult to add. The
custom_filters_score parse exists here:
https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/index/query/CustomFiltersScoreQueryParser.java,
you will need to add a parsing element for the max_score. Then, you will
need to change FiltersFunctionScore to allow to pass that max score and use
it in the computation there. If you run into problems, just ping.

On Thu, May 17, 2012 at 7:28 PM, Frederick Cheung <
frederick.cheung@gmail.com> wrote:

I'm using custom_filters_score to boost documents that match one or
more filters. Documents matching more of those filters should receive
a larger boost, but only up to a point.

For example a document matching 1 filters might get a boost of 1.2,
one matching 2 filters a boost of 1.44 but a document matching 3
filters would be capped at 1.44 (rather than 1.2 *1.44).
I can't find anything that looks like it might do that but I'd love to
be proved wrong. Failing that would a custom_filters_score option
along the lines of max_boost be of interest ? If so pointers to where
to start digging in the source gratefully accepted!

Thanks,

Fred


(Frederick Cheung) #3

On May 20, 9:03 pm, Shay Banon kim...@gmail.com wrote:

Heya, it definitely make sense, and should not be too difficult to add. The
custom_filters_score parse exists here:https://github.com/elasticsearch/elasticsearch/blob/master/src/main/j...,
you will need to add a parsing element for the max_score. Then, you will
need to change FiltersFunctionScore to allow to pass that max score and use
it in the computation there. If you run into problems, just ping.

Cool. I'll have a root around in there. Thanks!

Fred.

On Thu, May 17, 2012 at 7:28 PM, Frederick Cheung <

frederick.che...@gmail.com> wrote:

I'm using custom_filters_score to boost documents that match one or
more filters. Documents matching more of those filters should receive
a larger boost, but only up to a point.

For example a document matching 1 filters might get a boost of 1.2,
one matching 2 filters a boost of 1.44 but a document matching 3
filters would be capped at 1.44 (rather than 1.2 *1.44).
I can't find anything that looks like it might do that but I'd love to
be proved wrong. Failing that would a custom_filters_score option
along the lines of max_boost be of interest ? If so pointers to where
to start digging in the source gratefully accepted!

Thanks,

Fred


(Shay Banon) #4

Opened an issue: https://github.com/elasticsearch/elasticsearch/issues/1973,
might hack it if I get some time...

On Mon, May 21, 2012 at 11:36 AM, Frederick Cheung <
frederick.cheung@gmail.com> wrote:

On May 20, 9:03 pm, Shay Banon kim...@gmail.com wrote:

Heya, it definitely make sense, and should not be too difficult to add.
The
custom_filters_score parse exists here:
https://github.com/elasticsearch/elasticsearch/blob/master/src/main/j...,
you will need to add a parsing element for the max_score. Then, you will
need to change FiltersFunctionScore to allow to pass that max score and
use
it in the computation there. If you run into problems, just ping.

Cool. I'll have a root around in there. Thanks!

Fred.

On Thu, May 17, 2012 at 7:28 PM, Frederick Cheung <

frederick.che...@gmail.com> wrote:

I'm using custom_filters_score to boost documents that match one or
more filters. Documents matching more of those filters should receive
a larger boost, but only up to a point.

For example a document matching 1 filters might get a boost of 1.2,
one matching 2 filters a boost of 1.44 but a document matching 3
filters would be capped at 1.44 (rather than 1.2 *1.44).
I can't find anything that looks like it might do that but I'd love to
be proved wrong. Failing that would a custom_filters_score option
along the lines of max_boost be of interest ? If so pointers to where
to start digging in the source gratefully accepted!

Thanks,

Fred


(Frederick Cheung) #5

On May 23, 10:33 pm, Shay Banon kim...@gmail.com wrote:

Opened an issue:https://github.com/elasticsearch/elasticsearch/issues/1973,
might hack it if I get some time...

You beat me to it ! Good to see that what you ended up was basically
what I was doing!
Thanks.

Fred

On Mon, May 21, 2012 at 11:36 AM, Frederick Cheung <

frederick.che...@gmail.com> wrote:

On May 20, 9:03 pm, Shay Banon kim...@gmail.com wrote:

Heya, it definitely make sense, and should not be too difficult to add.
The
custom_filters_score parse exists here:
https://github.com/elasticsearch/elasticsearch/blob/master/src/main/j...,
you will need to add a parsing element for the max_score. Then, you will
need to change FiltersFunctionScore to allow to pass that max score and
use
it in the computation there. If you run into problems, just ping.

Cool. I'll have a root around in there. Thanks!

Fred.

On Thu, May 17, 2012 at 7:28 PM, Frederick Cheung <

frederick.che...@gmail.com> wrote:

I'm using custom_filters_score to boost documents that match one or
more filters. Documents matching more of those filters should receive
a larger boost, but only up to a point.

For example a document matching 1 filters might get a boost of 1.2,
one matching 2 filters a boost of 1.44 but a document matching 3
filters would be capped at 1.44 (rather than 1.2 *1.44).
I can't find anything that looks like it might do that but I'd love to
be proved wrong. Failing that would a custom_filters_score option
along the lines of max_boost be of interest ? If so pointers to where
to start digging in the source gratefully accepted!

Thanks,

Fred


(system) #6