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 <caomanhdat...@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 <u...@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: u...@thetaphi.de >> >> >> >> From: Đạt Cao Mạnh [mailto:caomanhdat...@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: caomanhdat...@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: caomanhdat...@gmail.com > > Hanoi University of Science and Technology > School of information & communication technology > Class : Computer Science K54 -- Adrien --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org