You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Toby Lazar <tl...@capitaltg.com> on 2013/11/01 00:48:11 UTC

Re: How to get similarity score between 0 and 1 not relative score

I think you are looking for something like this, though you can omit the fq
section:


http://localhost:8983/solr/collection/select?abc=text:bob&q={!func}scale(product(query($abc),1),0,1)&fq={!
frange l=0.9}$q

Also, I don't understand all the fuss about normalized scores.  In the
linked example, I can see an interest in searching for "apple bannana",
"zzz yyy xxx qqq kkk ttt rrr 111", etc. and wanting only close matches for
that point in time.  Would this be a good use for this approach?  I
understand that the results can change if the documents in the index change.

Thanks,

Toby



On Thu, Oct 31, 2013 at 12:56 AM, Anshum Gupta <an...@anshumgupta.net>wrote:

> Hi Susheel,
>
> Have a look at this:
> http://wiki.apache.org/lucene-java/ScoresAsPercentages
>
> You may really want to reconsider doing that.
>
>
>
>
> On Thu, Oct 31, 2013 at 9:41 AM, sushil sharma <sushil2777@yahoo.co.in
> >wrote:
>
> > Hi,
> >
> > We have a requirement where user would like to see a score (between 0 to
> > 1) which can tell how close the input search string is with result
> string.
> > So if input was very close but not exact matach, score could be .90 etc.
> >
> > I do understand that we can get score from solr & divide by highest score
> > but that will always show 1 even if we match was not exact.
> >
> > Regards,
> > Susheel
>
>
>
>
> --
>
> Anshum Gupta
> http://www.anshumgupta.net
>

Re: How to get similarity score between 0 and 1 not relative score

Posted by Peter Keegan <pe...@gmail.com>.
There's another use case for scaling the score. Suppose I want to compute a
custom score based on the weighted sum of:

- product(0.75, relevance score)
- product(0.25, value from another field)

For this to work, both fields must have values between 0-1, for example.
Toby's example using the scale function seems to work, but you have to use
fq to eliminate results with score=0. It seems this is somewhat expensive,
since the scaling can't be done until all results have been collected to
get the max score. Then, are the results resorted? I haven't looked
closely, yet.

Peter


Peter




On Thu, Oct 31, 2013 at 7:48 PM, Toby Lazar <tl...@capitaltg.com> wrote:

> I think you are looking for something like this, though you can omit the fq
> section:
>
>
>
> http://localhost:8983/solr/collection/select?abc=text:bob&q={!func}scale(product(query($abc),1),0,1)&fq={
> !
> frange l=0.9}$q
>
> Also, I don't understand all the fuss about normalized scores.  In the
> linked example, I can see an interest in searching for "apple bannana",
> "zzz yyy xxx qqq kkk ttt rrr 111", etc. and wanting only close matches for
> that point in time.  Would this be a good use for this approach?  I
> understand that the results can change if the documents in the index
> change.
>
> Thanks,
>
> Toby
>
>
>
> On Thu, Oct 31, 2013 at 12:56 AM, Anshum Gupta <anshum@anshumgupta.net
> >wrote:
>
> > Hi Susheel,
> >
> > Have a look at this:
> > http://wiki.apache.org/lucene-java/ScoresAsPercentages
> >
> > You may really want to reconsider doing that.
> >
> >
> >
> >
> > On Thu, Oct 31, 2013 at 9:41 AM, sushil sharma <sushil2777@yahoo.co.in
> > >wrote:
> >
> > > Hi,
> > >
> > > We have a requirement where user would like to see a score (between 0
> to
> > > 1) which can tell how close the input search string is with result
> > string.
> > > So if input was very close but not exact matach, score could be .90
> etc.
> > >
> > > I do understand that we can get score from solr & divide by highest
> score
> > > but that will always show 1 even if we match was not exact.
> > >
> > > Regards,
> > > Susheel
> >
> >
> >
> >
> > --
> >
> > Anshum Gupta
> > http://www.anshumgupta.net
> >
>