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 <[email protected]> wrote: > On Fri, Sep 20, 2013 at 8:01 AM, Shai Erera <[email protected]> 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: [email protected] > For additional commands, e-mail: [email protected] > >
