You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by Đạt Cao Mạnh <ca...@gmail.com> on 2015/06/29 12:05:28 UTC

Query needsScores

In Lucene search, i see the check if(needsScores) in many places. Can we
devide current queries to Query (that compute score) and Filter (that not
compute score) and remove needsScores flag?

-- 
*Best regards,*
*Cao Mạnh Đạt*






*D.O.B : 31-07-1991Cell: (+84) 946.328.329E-mail: caomanhdat317@gmail.com
<ca...@gmail.com>Hanoi University of Science and TechnologySchool
of information & communication technologyClass : Computer Science K54*

Re: Query needsScores

Posted by Adrien Grand <jp...@gmail.com>.
We could do that but it doesn't look to me like it would help. Can you
give a concrete example of a class that you would like to split based
on the value of needsScores?

On Mon, Jun 29, 2015 at 5:00 PM, Đạt Cao Mạnh <ca...@gmail.com> wrote:
> Hi Andrien,
> I mean can we centralise the check of flag in one place create different
> classes based on the checking?
>
> On Mon, Jun 29, 2015 at 6:01 PM, Adrien Grand <jp...@gmail.com> wrote:
>>
>> Actually passing the needsScore flag from collector to Weight is
>> exactly why we did this change: collectors can now tell whether they
>> need scores or not so that we can optimize query execution. Before we
>> did this change, we had to rely on users to build an "optimized" query
>> and for instance put a ConstantScoreQuery(TermFilter) in their
>> MUST_NOT clauses instead of passing a simple TermQuery that would load
>> norms and freqs even though it was not necessary.
>>
>> On Mon, Jun 29, 2015 at 12:36 PM, Đạt Cao Mạnh <ca...@gmail.com>
>> wrote:
>> > Hi Uwe,
>> > But I think passing around needsScore flag from searcher, collector,
>> > query,
>> > weight, scorer is not a neat solution.
>> >
>> > On Mon, Jun 29, 2015 at 5:29 PM, Uwe Schindler <uw...@thetaphi.de> wrote:
>> >>
>> >> Hi Dat,
>> >>
>> >>
>> >>
>> >> no we cannot remove that. In Lucene 5, Filters are deprecated and will
>> >> disappear completely soon. Filtering is also done by the Query class
>> >> (in
>> >> fact the backwards compatibility abstract Filter class now extends
>> >> Query).
>> >> The needsScore is used to tell the Query if the consumer needs scores
>> >> (e.g.,
>> >> if you add a Query using BooleanClause.FILTER to a BooleanQuery).
>> >>
>> >>
>> >>
>> >> Uwe
>> >>
>> >>
>> >>
>> >> -----
>> >>
>> >> Uwe Schindler
>> >>
>> >> H.-H.-Meier-Allee 63, D-28213 Bremen
>> >>
>> >> http://www.thetaphi.de
>> >>
>> >> eMail: uwe@thetaphi.de
>> >>
>> >>
>> >>
>> >> From: Đạt Cao Mạnh [mailto:caomanhdat317@gmail.com]
>> >> Sent: Monday, June 29, 2015 12:05 PM
>> >> To: dev@lucene.apache.org
>> >> Subject: Query needsScores
>> >>
>> >>
>> >>
>> >> In Lucene search, i see the check if(needsScores) in many places. Can
>> >> we
>> >> devide current queries to Query (that compute score) and Filter (that
>> >> not
>> >> compute score) and remove needsScores flag?
>> >>
>> >>
>> >> --
>> >>
>> >> Best regards,
>> >>
>> >> Cao Mạnh Đạt
>> >>
>> >> D.O.B : 31-07-1991
>> >> Cell: (+84) 946.328.329
>> >> E-mail: caomanhdat317@gmail.com
>> >>
>> >> Hanoi University of Science and Technology
>> >> School of information & communication technology
>> >> Class : Computer Science K54
>> >
>> >
>> >
>> >
>> > --
>> > Best regards,
>> > Cao Mạnh Đạt
>> > D.O.B : 31-07-1991
>> > Cell: (+84) 946.328.329
>> > E-mail: caomanhdat317@gmail.com
>> >
>> > Hanoi University of Science and Technology
>> > School of information & communication technology
>> > Class : Computer Science K54
>>
>>
>>
>> --
>> Adrien
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
>> For additional commands, e-mail: dev-help@lucene.apache.org
>>
>
>
>
> --
> Best regards,
> Cao Mạnh Đạt
> D.O.B : 31-07-1991
> Cell: (+84) 946.328.329
> E-mail: caomanhdat317@gmail.com
>
> Hanoi University of Science and Technology
> School of information & communication technology
> Class : Computer Science K54



-- 
Adrien

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


Re: Query needsScores

Posted by Đạt Cao Mạnh <ca...@gmail.com>.
Hi Andrien,
I mean can we centralise the check of flag in one place create different
classes based on the checking?

On Mon, Jun 29, 2015 at 6:01 PM, Adrien Grand <jp...@gmail.com> wrote:

> Actually passing the needsScore flag from collector to Weight is
> exactly why we did this change: collectors can now tell whether they
> need scores or not so that we can optimize query execution. Before we
> did this change, we had to rely on users to build an "optimized" query
> and for instance put a ConstantScoreQuery(TermFilter) in their
> MUST_NOT clauses instead of passing a simple TermQuery that would load
> norms and freqs even though it was not necessary.
>
> On Mon, Jun 29, 2015 at 12:36 PM, Đạt Cao Mạnh <ca...@gmail.com>
> wrote:
> > Hi Uwe,
> > But I think passing around needsScore flag from searcher, collector,
> query,
> > weight, scorer is not a neat solution.
> >
> > On Mon, Jun 29, 2015 at 5:29 PM, Uwe Schindler <uw...@thetaphi.de> wrote:
> >>
> >> Hi Dat,
> >>
> >>
> >>
> >> no we cannot remove that. In Lucene 5, Filters are deprecated and will
> >> disappear completely soon. Filtering is also done by the Query class (in
> >> fact the backwards compatibility abstract Filter class now extends
> Query).
> >> The needsScore is used to tell the Query if the consumer needs scores
> (e.g.,
> >> if you add a Query using BooleanClause.FILTER to a BooleanQuery).
> >>
> >>
> >>
> >> Uwe
> >>
> >>
> >>
> >> -----
> >>
> >> Uwe Schindler
> >>
> >> H.-H.-Meier-Allee 63, D-28213 Bremen
> >>
> >> http://www.thetaphi.de
> >>
> >> eMail: uwe@thetaphi.de
> >>
> >>
> >>
> >> From: Đạt Cao Mạnh [mailto:caomanhdat317@gmail.com]
> >> Sent: Monday, June 29, 2015 12:05 PM
> >> To: dev@lucene.apache.org
> >> Subject: Query needsScores
> >>
> >>
> >>
> >> In Lucene search, i see the check if(needsScores) in many places. Can we
> >> devide current queries to Query (that compute score) and Filter (that
> not
> >> compute score) and remove needsScores flag?
> >>
> >>
> >> --
> >>
> >> Best regards,
> >>
> >> Cao Mạnh Đạt
> >>
> >> D.O.B : 31-07-1991
> >> Cell: (+84) 946.328.329
> >> E-mail: caomanhdat317@gmail.com
> >>
> >> Hanoi University of Science and Technology
> >> School of information & communication technology
> >> Class : Computer Science K54
> >
> >
> >
> >
> > --
> > Best regards,
> > Cao Mạnh Đạt
> > D.O.B : 31-07-1991
> > Cell: (+84) 946.328.329
> > E-mail: caomanhdat317@gmail.com
> >
> > Hanoi University of Science and Technology
> > School of information & communication technology
> > Class : Computer Science K54
>
>
>
> --
> Adrien
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
> For additional commands, e-mail: dev-help@lucene.apache.org
>
>


-- 
*Best regards,*
*Cao Mạnh Đạt*






*D.O.B : 31-07-1991Cell: (+84) 946.328.329E-mail: caomanhdat317@gmail.com
<ca...@gmail.com>Hanoi University of Science and TechnologySchool
of information & communication technologyClass : Computer Science K54*

Re: Query needsScores

Posted by Adrien Grand <jp...@gmail.com>.
Actually passing the needsScore flag from collector to Weight is
exactly why we did this change: collectors can now tell whether they
need scores or not so that we can optimize query execution. Before we
did this change, we had to rely on users to build an "optimized" query
and for instance put a ConstantScoreQuery(TermFilter) in their
MUST_NOT clauses instead of passing a simple TermQuery that would load
norms and freqs even though it was not necessary.

On Mon, Jun 29, 2015 at 12:36 PM, Đạt Cao Mạnh <ca...@gmail.com> wrote:
> Hi Uwe,
> But I think passing around needsScore flag from searcher, collector, query,
> weight, scorer is not a neat solution.
>
> On Mon, Jun 29, 2015 at 5:29 PM, Uwe Schindler <uw...@thetaphi.de> wrote:
>>
>> Hi Dat,
>>
>>
>>
>> no we cannot remove that. In Lucene 5, Filters are deprecated and will
>> disappear completely soon. Filtering is also done by the Query class (in
>> fact the backwards compatibility abstract Filter class now extends Query).
>> The needsScore is used to tell the Query if the consumer needs scores (e.g.,
>> if you add a Query using BooleanClause.FILTER to a BooleanQuery).
>>
>>
>>
>> Uwe
>>
>>
>>
>> -----
>>
>> Uwe Schindler
>>
>> H.-H.-Meier-Allee 63, D-28213 Bremen
>>
>> http://www.thetaphi.de
>>
>> eMail: uwe@thetaphi.de
>>
>>
>>
>> From: Đạt Cao Mạnh [mailto:caomanhdat317@gmail.com]
>> Sent: Monday, June 29, 2015 12:05 PM
>> To: dev@lucene.apache.org
>> Subject: Query needsScores
>>
>>
>>
>> In Lucene search, i see the check if(needsScores) in many places. Can we
>> devide current queries to Query (that compute score) and Filter (that not
>> compute score) and remove needsScores flag?
>>
>>
>> --
>>
>> Best regards,
>>
>> Cao Mạnh Đạt
>>
>> D.O.B : 31-07-1991
>> Cell: (+84) 946.328.329
>> E-mail: caomanhdat317@gmail.com
>>
>> Hanoi University of Science and Technology
>> School of information & communication technology
>> Class : Computer Science K54
>
>
>
>
> --
> Best regards,
> Cao Mạnh Đạt
> D.O.B : 31-07-1991
> Cell: (+84) 946.328.329
> E-mail: caomanhdat317@gmail.com
>
> Hanoi University of Science and Technology
> School of information & communication technology
> Class : Computer Science K54



-- 
Adrien

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


Re: Query needsScores

Posted by Đạt Cao Mạnh <ca...@gmail.com>.
Hi Uwe,
But I think passing around needsScore flag from searcher, collector, query,
weight, scorer is not a neat solution.

On Mon, Jun 29, 2015 at 5:29 PM, Uwe Schindler <uw...@thetaphi.de> wrote:

> Hi Dat,
>
>
>
> no we cannot remove that. In Lucene 5, Filters are deprecated and will
> disappear completely soon. Filtering is also done by the Query class (in
> fact the backwards compatibility abstract Filter class now extends Query).
> The needsScore is used to tell the Query if the consumer needs scores
> (e.g., if you add a Query using BooleanClause.FILTER to a BooleanQuery).
>
>
>
> Uwe
>
>
>
> -----
>
> Uwe Schindler
>
> H.-H.-Meier-Allee 63, D-28213 Bremen
>
> http://www.thetaphi.de
>
> eMail: uwe@thetaphi.de
>
>
>
> *From:* Đạt Cao Mạnh [mailto:caomanhdat317@gmail.com]
> *Sent:* Monday, June 29, 2015 12:05 PM
> *To:* dev@lucene.apache.org
> *Subject:* Query needsScores
>
>
>
> In Lucene search, i see the check if(needsScores) in many places. Can we
> devide current queries to Query (that compute score) and Filter (that not
> compute score) and remove needsScores flag?
>
>
> --
>
> *Best regards,*
>
> *Cao Mạnh Đạt*
>
>
>
>
>
> *D.O.B : 31-07-1991Cell: (+84) 946.328.329E-mail: caomanhdat317@gmail.com
> <ca...@gmail.com>*
> *Hanoi University of Science and Technology*
> *School of information & communication technology**Class : Computer
> Science K54*
>



-- 
*Best regards,*
*Cao Mạnh Đạt*






*D.O.B : 31-07-1991Cell: (+84) 946.328.329E-mail: caomanhdat317@gmail.com
<ca...@gmail.com>Hanoi University of Science and TechnologySchool
of information & communication technologyClass : Computer Science K54*

RE: Query needsScores

Posted by Uwe Schindler <uw...@thetaphi.de>.
Hi Dat,

 

no we cannot remove that. In Lucene 5, Filters are deprecated and will disappear completely soon. Filtering is also done by the Query class (in fact the backwards compatibility abstract Filter class now extends Query). The needsScore is used to tell the Query if the consumer needs scores (e.g., if you add a Query using BooleanClause.FILTER to a BooleanQuery).

 

Uwe

 

-----

Uwe Schindler

H.-H.-Meier-Allee 63, D-28213 Bremen

 <http://www.thetaphi.de/> http://www.thetaphi.de

eMail: uwe@thetaphi.de

 

From: Đạt Cao Mạnh [mailto:caomanhdat317@gmail.com] 
Sent: Monday, June 29, 2015 12:05 PM
To: dev@lucene.apache.org
Subject: Query needsScores

 

In Lucene search, i see the check if(needsScores) in many places. Can we devide current queries to Query (that compute score) and Filter (that not compute score) and remove needsScores flag?



-- 

Best regards,

Cao Mạnh Đạt

D.O.B : 31-07-1991
Cell: (+84) 946.328.329
E-mail:  <ma...@gmail.com> caomanhdat317@gmail.com

Hanoi University of Science and Technology
School of information & communication technology
Class : Computer Science K54