You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Vlad Olenin <vo...@gmail.com> on 2008/11/26 05:47:58 UTC

calculating score - implementing your own 'Scorer' - how to?..

Hi,

I'm new to Lucene, so looking for some guidance as to the most efficient /
appropriate way to implement the following functionality.


* Each Document consists of a number of fields
* Each Field value, when indexed, can have different 'score' value
associated with it
** for simplicity, the score is presented as a bit mask
** each field value might have different score for the same field
** each field value might have different score for the different fields
*** eg, if doc1.field1.value = "val1, val2, val3", then index over field1
might have different score values associated with each value (here are
{docId.field, score} pairs):
***       val1 = {doc1.field1, '0011'},
***       val2 = {doc1.field1, '0101'},
***       val3 = {doc1.field1, '1011'}
* when the search is done, the final score for the document must be
calculated based on the bit combination of scores, eg:
** query = 'val1, val2', res = {doc1, '0001'}  (0011 & 0101)
** query = 'val1, val3', res = {doc1, '0011'}  (0011 & 1011)


How do I implement the above scoring logic? Thanks,

Vlad

Re: calculating score - implementing your own 'Scorer' - how to?..

Posted by Vlad Olenin <vo...@gmail.com>.
Thanks for the hints, Grant. I'm not sure if using boost on its own will
help though.. From my limited understanding, by default, the product
(boost_val1 * boost_val2) is always greater than any of the multipliers
boost_val1 or boost_val2....

If it were possible to override the logic on how the final score for the
document is getting calculated based on the individual boost values of the
fields, then it might possibly work.... Do you know if it's possible to
override this logic? I'll have a look on the 'functions' package that you
mentioned - probably that's where it's done..

Thanks,

Vlad



On Fri, Nov 28, 2008 at 7:42 AM, Grant Ingersoll <gs...@apache.org>wrote:

> Hi Vlad,
>
> I believe you can achieve this using the function package (i.e. Function
> Queries, org.apache.lucene.search.function).    The other thing that comes
> to mind is, if you don't truly need the bit mask for other things, is to
> encode it into the Field as a boost value.  This may be complicated by the
> lack of granularity in boost encoding, but it might work for you.
>
> -Grant
>
>
>
>
> On Nov 25, 2008, at 11:47 PM, Vlad Olenin wrote:
>
>  Hi,
>>
>> I'm new to Lucene, so looking for some guidance as to the most efficient /
>> appropriate way to implement the following functionality.
>>
>>
>> * Each Document consists of a number of fields
>> * Each Field value, when indexed, can have different 'score' value
>> associated with it
>> ** for simplicity, the score is presented as a bit mask
>> ** each field value might have different score for the same field
>> ** each field value might have different score for the different fields
>> *** eg, if doc1.field1.value = "val1, val2, val3", then index over field1
>> might have different score values associated with each value (here are
>> {docId.field, score} pairs):
>> ***       val1 = {doc1.field1, '0011'},
>> ***       val2 = {doc1.field1, '0101'},
>> ***       val3 = {doc1.field1, '1011'}
>> * when the search is done, the final score for the document must be
>> calculated based on the bit combination of scores, eg:
>> ** query = 'val1, val2', res = {doc1, '0001'}  (0011 & 0101)
>> ** query = 'val1, val3', res = {doc1, '0011'}  (0011 & 1011)
>>
>>
>> How do I implement the above scoring logic? Thanks,
>>
>> Vlad
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>

Re: calculating score - implementing your own 'Scorer' - how to?..

Posted by Grant Ingersoll <gs...@apache.org>.
Hi Vlad,

I believe you can achieve this using the function package (i.e.  
Function Queries, org.apache.lucene.search.function).    The other  
thing that comes to mind is, if you don't truly need the bit mask for  
other things, is to encode it into the Field as a boost value.  This  
may be complicated by the lack of granularity in boost encoding, but  
it might work for you.

-Grant



On Nov 25, 2008, at 11:47 PM, Vlad Olenin wrote:

> Hi,
>
> I'm new to Lucene, so looking for some guidance as to the most  
> efficient /
> appropriate way to implement the following functionality.
>
>
> * Each Document consists of a number of fields
> * Each Field value, when indexed, can have different 'score' value
> associated with it
> ** for simplicity, the score is presented as a bit mask
> ** each field value might have different score for the same field
> ** each field value might have different score for the different  
> fields
> *** eg, if doc1.field1.value = "val1, val2, val3", then index over  
> field1
> might have different score values associated with each value (here are
> {docId.field, score} pairs):
> ***       val1 = {doc1.field1, '0011'},
> ***       val2 = {doc1.field1, '0101'},
> ***       val3 = {doc1.field1, '1011'}
> * when the search is done, the final score for the document must be
> calculated based on the bit combination of scores, eg:
> ** query = 'val1, val2', res = {doc1, '0001'}  (0011 & 0101)
> ** query = 'val1, val3', res = {doc1, '0011'}  (0011 & 1011)
>
>
> How do I implement the above scoring logic? Thanks,
>
> Vlad



---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org