Return-Path: Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: (qmail 33879 invoked from network); 22 Feb 2010 11:35:34 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 22 Feb 2010 11:35:34 -0000 Received: (qmail 81732 invoked by uid 500); 22 Feb 2010 11:35:31 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 81673 invoked by uid 500); 22 Feb 2010 11:35:31 -0000 Mailing-List: contact java-user-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: java-user@lucene.apache.org Delivered-To: mailing list java-user@lucene.apache.org Received: (qmail 81658 invoked by uid 99); 22 Feb 2010 11:35:31 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 22 Feb 2010 11:35:31 +0000 X-ASF-Spam-Status: No, hits=1.2 required=10.0 tests=SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [85.25.71.29] (HELO mail.troja.net) (85.25.71.29) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 22 Feb 2010 11:35:22 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.troja.net (Postfix) with ESMTP id E2241D3600C for ; Mon, 22 Feb 2010 12:35:01 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mail.troja.net Received: from mail.troja.net ([127.0.0.1]) by localhost (megaira.troja.net [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id lOvL-9zllRm8 for ; Mon, 22 Feb 2010 12:34:59 +0100 (CET) Received: from VEGA (gate2.marum.de [134.102.237.2]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by mail.troja.net (Postfix) with ESMTPSA id E5C59D36008 for ; Mon, 22 Feb 2010 12:34:58 +0100 (CET) From: "Uwe Schindler" To: References: <27684388.post@talk.nabble.com> <8c4e68611002220132l6719a4b5s4b7e663e12cd0cf3@mail.gmail.com> <000901cab3a3$7deb8a70$79c29f50$@de> <27685594.post@talk.nabble.com> <8c4e68611002220325y7001834dhd3a5eb2867f1109e@mail.gmail.com> In-Reply-To: <8c4e68611002220325y7001834dhd3a5eb2867f1109e@mail.gmail.com> Subject: RE: Boost Problem (again), need example ! Date: Mon, 22 Feb 2010 12:35:07 +0100 Message-ID: <001001cab3b3$15e72c30$41b58490$@de> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: AcqzselovIIi3plKR62IyQc/QLqvsQAAKOHA Content-Language: de X-Virus-Checked: Checked by ClamAV on apache.org The simple fix for that is to wrap the subQuery using: new = ConstantScoreQuery(new QueryWrapperFilter(query)) - after that its score = is constant and the ValueSource only scores. I recommend to use NumericField for indexing this boost (no storing = needed, only indexing, precisionStep=3DInteger.MAX_VALUE). Else (if = using standard Field) the boost field does not need to be "stored", it = must be indexed as NOT_ANALYZED.=20 ----- Uwe Schindler H.-H.-Meier-Allee 63, D-28213 Bremen http://www.thetaphi.de eMail: uwe@thetaphi.de > -----Original Message----- > From: Ian Lea [mailto:ian.lea@gmail.com] > Sent: Monday, February 22, 2010 12:26 PM > To: java-user@lucene.apache.org > Subject: Re: Boost Problem (again), need example ! >=20 > boostField needs to be indexed to be used in the FieldScoreQuery. >=20 > Are you now using one of the the latest releases that Uwe mentioned, > with fixes for CustomScoreQuery? >=20 > And unless you provide your own implementation of > CustomScoreQuery.customScore() I think that you are still not > guaranteed to get what you want since the default implementation is to > calculate the score as subQueryScore * valSrcScore. >=20 >=20 > -- > Ian. >=20 >=20 > On Mon, Feb 22, 2010 at 11:00 AM, pdaures > wrote: > > > > HI ! > > Thank you for your help. > > I think I don't use CustomScoreQuery correctly when I do a "search". > > > > BooleanQuery combinedQuery =3D new BooleanQuery(); > > combinedQuery.add(textQuery, Occur.MUST); > > combinedQuery.add(titleQuery, Occur.MUST); > > > > CustomScoreQuery customQuery =3D new = CustomScoreQuery(combinedQuery,new > > FieldScoreQuery(BOOST_FIELD,Type.INT)); > > > > indexSearcher.search(..., customQuery, ....). > > > > in order to index the BOOST_FIELD, I do that : > > Field boostField =3D new Field(BOOST_FIELD, Integer.toString(boost), > > Field.Store.YES, Field.Index.ANALYZED.NO); > > > > > > Is that correct ? > > Thank you > > > > > > > > > > Uwe Schindler wrote: > >> > >> It's CustomScoreQuery in 2.9 and 3.0. > >> > >> Please wait for 2.9.2 and 3.0.1 for an important API change in this > >> experimental query type to work correct with the new per-segment- > search! > >> You can test the release artifacts of both new versions here: > >> http://people.apache.org/~uschindler/staging-area/lucene-292-301- > take2-rev912433/ > >> > >> With e.g. ValueSourceQuery you can score your documents using a > separate > >> numeric field from your documents (it uses FieldCache). > >> > >> Uwe > >> > >> ----- > >> Uwe Schindler > >> H.-H.-Meier-Allee 63, D-28213 Bremen > >> http://www.thetaphi.de > >> eMail: uwe@thetaphi.de > >> > >>> -----Original Message----- > >>> From: Ian Lea [mailto:ian.lea@gmail.com] > >>> Sent: Monday, February 22, 2010 10:33 AM > >>> To: java-user@lucene.apache.org > >>> Subject: Re: Boost Problem (again), need example ! > >>> > >>> Can't you simply sort by descending score (your score, not > lucene's)? > >>> Seems to me that would give you what you are asking for. > >>> > >>> The setBoost() method is unlikely to work consistently because it > only > >>> infuences the score rather than setting it. If your John Mickeal > doc > >>> happens to have a higher lucene score, because of the normal > >>> idf/tf/etc stuff, then the setBoost() with a higher value for John > >>> Smith may well not be enough to force John Smith to the top. > >>> > >>> I don't know enough about function queries to help you much there > but > >>> FieldScoreQuery might work. I can't see any sign of class > >>> FunctionQuery in the 3.0.0 core package so am not clear what that > is. > >>> > >>> > >>> -- > >>> Ian. > >>> > >>> > >>> > >>> On Mon, Feb 22, 2010 at 8:54 AM, pdaures = > >>> wrote: > >>> > > >>> > Hi, > >>> > I know that there are many topics about scoring issues, but I > didn't > >>> find an > >>> > answer in the topics. > >>> > This is the problem : > >>> > Imagine I'm a teacher, and I have to index all the results, > comments > >>> and > >>> > score about students. > >>> > > >>> > Student : > >>> > String name (eg : John Smith) > >>> > String comments : (eg: John is a good student, but he needs to = be > >>> more self > >>> > confident bla bla bla) > >>> > float score (eg : 98) > >>> > > >>> > I have to index all the students and when I use the search = class, > I > >>> want to > >>> > get first the best students. So, if John Smith is a better > student > >>> than John > >>> > Mickael, when I search "John" I want to have John Smith BEFORE > John > >>> Mickeal. > >>> > > >>> > To do that, I'm using BooleanQuery to search in name and comment > >>> fields. > >>> > > >>> > First, I thought I could use the function = Document.setBoost(float > >>> boost) > >>> > while indexing student, with boost =3D Student.score. But the > result > >>> was not > >>> > what I was expected, it didn't work correctly. > >>> > > >>> > Then I thought I could use a FunctionQuery to search : > >>> > FunctionQuery functionQuery =3D new FunctionQuery(new > >>> > ReverseOrdFieldSource("score")); > >>> > But the result was still incorrect. > >>> > > >>> > I don't know what I'm doing wrong. Could you help me to find a > >>> solution ? > >>> > Thank you :) > >>> > -- > >>> > View this message in context: http://old.nabble.com/Boost- > Problem- > >>> %28again%29%2C-need-example-%21-tp27684388p27684388.html > >>> > Sent from the Lucene - Java Users mailing list archive at > Nabble.com. > >>> > > >>> > > >>> > = ----------------------------------------------------------------- > ---- > >>> > To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org > >>> > For additional commands, e-mail: = java-user-help@lucene.apache.org > >>> > > >>> > > >>> > >>> = ------------------------------------------------------------------- > -- > >>> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org > >>> For additional commands, e-mail: java-user-help@lucene.apache.org > >> > >> > >> > >> = -------------------------------------------------------------------- > - > >> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org > >> For additional commands, e-mail: java-user-help@lucene.apache.org > >> > >> > >> > > > > -- > > View this message in context: http://old.nabble.com/Boost-Problem- > %28again%29%2C-need-example-%21-tp27684388p27685594.html > > Sent from the Lucene - Java Users mailing list archive at = Nabble.com. > > > > > > = --------------------------------------------------------------------- > > To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org > > For additional commands, e-mail: java-user-help@lucene.apache.org > > > > >=20 > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org > For additional commands, e-mail: java-user-help@lucene.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org For additional commands, e-mail: java-user-help@lucene.apache.org