Return-Path: Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: (qmail 91959 invoked from network); 13 Aug 2009 07:37:27 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 13 Aug 2009 07:37:27 -0000 Received: (qmail 59041 invoked by uid 500); 13 Aug 2009 07:37:31 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 58960 invoked by uid 500); 13 Aug 2009 07:37: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 58950 invoked by uid 99); 13 Aug 2009 07:37:31 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 13 Aug 2009 07:37:31 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of simon.willnauer@googlemail.com designates 209.85.218.211 as permitted sender) Received: from [209.85.218.211] (HELO mail-bw0-f211.google.com) (209.85.218.211) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 13 Aug 2009 07:37:21 +0000 Received: by bwz8 with SMTP id 8so442971bwz.28 for ; Thu, 13 Aug 2009 00:36:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:mime-version:received:reply-to:in-reply-to :references:date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=bPd+krEzkpwJblE4wys/RtU13in/9C+F5gLEPF4FEXM=; b=WdaycRRhuOXS70EadieOeBpdYMYNwB8b6b7pV8hsYbBfNs8sgVyPHNk9DLvvFEzFgN qJ6c5xX4YR1LfkF3gCpo7JkwEAYDb6KfpNUCYvCvbBtgV3whMvbB+eWzCq+G2SsVCiuh Vsfulf5P4PB8CdIV1e0WFH8mOsbWq3ugqFZxE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=mime-version:reply-to:in-reply-to:references:date:message-id :subject:from:to:content-type:content-transfer-encoding; b=Zs1d+HbSNNs5l8W/86uGZLyqiwatGe/fVUqZFtwGJuaDPgXpE2dxh4IFKO+TxcvT0C 9jNTI343GPgo97BedDabnS//MI7rLZvCa+9jmxSW6JeVhNhNsvlNqPHsMIr0nOvhsUbg K9+iRt4ObOMeQS6j1mfAyLuRl5TP4wv7oglI4= MIME-Version: 1.0 Received: by 10.239.156.146 with SMTP id m18mr72938hbc.24.1250149019270; Thu, 13 Aug 2009 00:36:59 -0700 (PDT) Reply-To: simon.willnauer@gmail.com In-Reply-To: <11a518030908122110t3861ecf9vd89403905426a998@mail.gmail.com> References: <11a518030908121246i2657ca68sb25e438015436fe9@mail.gmail.com> <11a518030908122110t3861ecf9vd89403905426a998@mail.gmail.com> Date: Thu, 13 Aug 2009 09:36:59 +0200 Message-ID: Subject: Re: term query boost problem From: Simon Willnauer To: java-user@lucene.apache.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org Chrisitan, if you haven't done so you might find Luke (http://www.getopt.org/luke/) very helpful so see what has been indexed and how. simon On Thu, Aug 13, 2009 at 6:10 AM, Christian Bongiorno wrote: > turns out the index is being built with lower-case terms which is why we > aren't getting hits the way we expect. When I change my search terms to > lower I see more of what I expect. > > Gonna keep working on this and post updates. > > On Wed, Aug 12, 2009 at 12:46 PM, Christian Bongiorno < > christian@bongiorno.org> wrote: > >> I have a situation where I have a series of terms queries as part of a >> BooleanQuery. >> >> example: >> >> term: 'sole type' -> leather >> =C2=A0 BooleanClause.SHOULD_OCCURR >> term: 'title' -> 'Men's Golf shoes' >> =C2=A0 BooleanClause.SHOULD_OCCURR >> ... >> >> But, some terms are incredibly powerful indicators of match >> term: 'band type' -> 'gold' >> >> Normally, I would set this as a field boost in the query. Problem is, it >> isn't producing ANY changes even when I set the boost score absurdly hig= h. I >> have also tried to set the BooleanClause.MUST on my really important ter= m >> and I get no results at all. >> >> I tried a simple TermQuery for that (no clause) and got no results. Belo= w >> is a code snippet. I checked through the recent archives discussing fiel= d >> boosts and I am pretty confident I am doing it right. So, now I am presu= ming >> it's a problem with my query. >> >> =C2=A0 =C2=A0 private Query buildQuery(Map CatalogInfo) = { >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (CatalogInfo !=3D null && CatalogInfo.siz= e() > 0) { >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 BooleanQuery booleanQuery =3D = new BooleanQuery(); >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 for (Map.Entry= attributeValue : >> CatalogInfo.entrySet()) { >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 String attribute= Name =3D attributeValue.getKey(); >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 String[] attribu= teValues; >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (attributeVal= ue.getValue().indexOf(VALUES_DELIMITER) =3D=3D >> -1) { >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 at= tributeValues =3D new String[] >> {attributeValue.getValue()}; >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 } else { >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 at= tributeValues =3D >> attributeValue.getValue().split(VALUES_DELIMITER); >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 } >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 for (String attr= ibuteValue : attributeValues) { >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 St= ring escapedValue =3D >> QueryParser.escape(attributeValue).trim(); >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Te= rmQuery termQuery =3D new TermQuery(new >> Term(attributeName, escapedValue)); >> >> >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Fl= oat boostNumber =3D _boostMap.get(attributeName); // >> this is where 'band type' gets it's boost >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if= (boostNumber !=3D null) { >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 LOG.warn("Boost value found: " + boostNumber); >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 termQuery.setBoost(boostNumber); >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 } >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 bo= oleanQuery.add(termQuery, >> BooleanClause.Occur.SHOULD); >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 } >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 } >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 LOG.warn("Boolean query: " + b= ooleanQuery.toString()); >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return booleanQuery; >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 } >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 return null; >> =C2=A0 =C2=A0 } >> -- >> Christian Bongiorno >> >> > > > -- > Christian Bongiorno > --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org For additional commands, e-mail: java-user-help@lucene.apache.org