lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shai Erera <ser...@gmail.com>
Subject Re: Difference between CustomScoreProvider, FunctionQuery and Expression
Date Fri, 20 Sep 2013 15:39:04 GMT
Thanks Rob. So is there a NumericDVFieldSource-like in Lucene? I think it's
important that we have one.

Shai


On Fri, Sep 20, 2013 at 6:10 PM, Robert Muir <rcmuir@gmail.com> wrote:

> thats what it does. its more like a computed field. and you can sort
> by more than one of them.
>
> please see the JIRA issue for a description of the differences between
> function queries.
>
> On Fri, Sep 20, 2013 at 10:49 AM, Shai Erera <serera@gmail.com> wrote:
> > Yes, you're right, but that's unrelated to this thread. I passed
> > doScore=true and the scores come out the same, meaning Expression didn't
> > affect the actual score, only the sort-by value (which is ok).
> >
> > search Expression
> > doc=1, score=0.37158427, field=0.7431685328483582
> > doc=0, score=0.37158427, field=0.3715842664241791
> >
> > Shai
> >
> >
> > On Fri, Sep 20, 2013 at 5:10 PM, Robert Muir <rcmuir@gmail.com> wrote:
> >>
> >> On Fri, Sep 20, 2013 at 8:01 AM, Shai Erera <serera@gmail.com> wrote:
> >> >
> >> > Expression
> >> > I tried the new module, following TestDemoExpression and compiled the
> >> > expression using this code:
> >> >
> >> >     Expression expr = JavascriptCompiler.compile("_score * boost");
> >> >     SimpleBindings bindings = new SimpleBindings();
> >> >     bindings.add(new SortField("_score", SortField.Type.SCORE));
> >> >     bindings.add(new SortField("boost", SortField.Type.LONG));
> >> >
> >> > The result scores are:
> >> >
> >> > search Expression
> >> > doc=1, score=NaN, field=0.7431685328483582
> >> > doc=0, score=NaN, field=0.3715842664241791
> >> >
> >> > As you can see, both CustomScoreProvider and Expression methods return
> >> > same
> >> > scores for the docs, while the FunctionQuery method returns different
> >> > scores. The reason is that when using FunctionQuery, the scores of the
> >> > ValueSources are multiplied by queryWeight, which seems correct to me.
> >> >
> >> > Expression is more about sorting than scoring as far as I understand
> >> > (for
> >> > instance, the result FieldDocs.score is NaN)
> >>
> >> Why does that come as a surprise to you?  Pass true to indexsearcher
> >> to get the documents score back here.
> >>
> >> ======================= Release 2.9.0 2009-09-23 =======================
> >>
> >> Changes in backwards compatibility policy
> >>
> >> LUCENE-1575: Searchable.search(Weight, Filter, int, Sort) no longer
> >> computes a document score for each hit by default.
> >> ... (Shai Erera via Mike McCandless)
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
> >> For additional commands, e-mail: dev-help@lucene.apache.org
> >>
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
> For additional commands, e-mail: dev-help@lucene.apache.org
>
>

Mime
View raw message