Return-Path: Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: (qmail 54922 invoked from network); 4 Feb 2008 01:48:02 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 4 Feb 2008 01:48:02 -0000 Received: (qmail 49234 invoked by uid 500); 4 Feb 2008 01:47:48 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 49200 invoked by uid 500); 4 Feb 2008 01:47:47 -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 49189 invoked by uid 99); 4 Feb 2008 01:47:47 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 03 Feb 2008 17:47:47 -0800 X-ASF-Spam-Status: No, hits=1.2 required=10.0 tests=SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [208.97.132.202] (HELO spunkymail-a20.g.dreamhost.com) (208.97.132.202) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 04 Feb 2008 01:47:17 +0000 Received: from [192.168.0.3] (adsl-074-229-189-244.sip.rmo.bellsouth.net [74.229.189.244]) by spunkymail-a20.g.dreamhost.com (Postfix) with ESMTP id E7AA3E24ED for ; Sun, 3 Feb 2008 17:47:23 -0800 (PST) Message-Id: <9C49934D-68A2-459A-AB0C-B577AD53FE15@apache.org> From: Grant Ingersoll To: java-user@lucene.apache.org In-Reply-To: <295da8fe0802010541l740334fj70f4825e186113bb@mail.gmail.com> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v915) Subject: Re: Different levels of negative boosting Date: Sun, 3 Feb 2008 20:47:22 -0500 References: <295da8fe0801311149p23bfdfa4vcf87d5cfcfd44ba@mail.gmail.com> <6DF4A122-877C-44A6-8FC2-CF861C1E6732@apache.org> <295da8fe0802010541l740334fj70f4825e186113bb@mail.gmail.com> X-Mailer: Apple Mail (2.915) X-Virus-Checked: Checked by ClamAV on apache.org What are the other parts of your queries like? And why the need for the separate instantiations of the QueryParser? You might try something like: good^2 badA^0.1 badB^0.3 or some other bigger separation of the boost value between the good terms and the bad terms. The other thing to do is use the explain() method to see how the individual terms are being scored. -Grant On Feb 1, 2008, at 8:41 AM, prabin meitei wrote: > Hi Grant, > I have an index for articles containing fields 'id' , 'body' and > others > > BooleanQuery query = new BooleanQuery; > queryParser = new QueryParser("body", new StandardAnalyzer()); > query.add(queryParser.parse("keywords"), Occur.MUST); > > if i query at this level then i get all the articles I want. But I > want to > de-boost some of them if they matches another term > . > BooleanQuery q1 = new BooleanQuery; > BooleanQuery q2 = new BooleanQuery; > queryParser = new QueryParser("body", new StandardAnalyzer()); > q1.add(queryParser.parse("body"), Occur.SHOULD); > queryParser = new QueryParser("some field", new StandardAnalyzer()); > q2.add(queryParser.parse("keywords2"), Occur.SHOULD); > > q1.setBoost(0.1); > q2.setBoost(0.3); > query.add(q1, Occur.SHOULD); > query.add(q2, Occur.SHOULD); > ### what I want here is that any document matching the queries q1 > and q2 > will be boosted negatively(reducing their score but *not eliminating > from > the search result*) > # puting values less than 1.0 (as I tried doing) did not help > (lucene seems > to assume it as 1) > # if there was only one query then I could do it as I wrote in my > last mail. > But the problem is when there a multiple queries to reduce the score > by > multiple levels. > > or am I going in a wrong direction?? It wud be nice if you have some > suggestion. > > Prabin > > On Feb 1, 2008 6:32 PM, Grant Ingersoll wrote: > >> Hi Prabin, >> >> Can you give an example of what you would like a query to look like? >> Lucene doesn't do negative boosts (ok, w/ a patch, I think it can, >> but...) At any rate, the boosts are relative, so perhaps you just >> lower the boost to be very small for the "bad" terms and raise it >> higher for the good terms. >> >> What is the end goal of what you are trying to find? Perhaps there >> are some alternatives. >> >> -Grant >> >> On Jan 31, 2008, at 2:49 PM, prabin meitei wrote: >> >>> Hi, I want to give different levels of negative boost (reduce the >>> score) to >>> documents for different matching queries. How it can be done?? >>> Googling I >>> found out this link >>> http://wiki.apache.org/jakarta-lucene/CommunityContributions but >>> it just >>> gives the option of giving single level negative boost. >>> is there any way of having multiple matching queries and give them >>> different >>> negative boosts??? >>> >>> >>> Regards, >>> Prabin >> >> -------------------------- >> Grant Ingersoll >> http://lucene.grantingersoll.com >> http://www.lucenebootcamp.com >> >> Lucene Helpful Hints: >> http://wiki.apache.org/lucene-java/BasicsOfPerformance >> http://wiki.apache.org/lucene-java/LuceneFAQ >> >> >> >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org >> For additional commands, e-mail: java-user-help@lucene.apache.org >> >> -------------------------- Grant Ingersoll http://lucene.grantingersoll.com http://www.lucenebootcamp.com Lucene Helpful Hints: http://wiki.apache.org/lucene-java/BasicsOfPerformance http://wiki.apache.org/lucene-java/LuceneFAQ --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org For additional commands, e-mail: java-user-help@lucene.apache.org