Return-Path: Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: (qmail 79948 invoked from network); 3 Aug 2009 10:29:06 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 3 Aug 2009 10:29:06 -0000 Received: (qmail 80823 invoked by uid 500); 3 Aug 2009 10:29:09 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 80729 invoked by uid 500); 3 Aug 2009 10:29:09 -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 80719 invoked by uid 99); 3 Aug 2009 10:29:09 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 03 Aug 2009 10:29:09 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of ian.lea@gmail.com designates 72.14.220.159 as permitted sender) Received: from [72.14.220.159] (HELO fg-out-1718.google.com) (72.14.220.159) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 03 Aug 2009 10:28:58 +0000 Received: by fg-out-1718.google.com with SMTP id l26so965034fgb.4 for ; Mon, 03 Aug 2009 03:28:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :from:date:message-id:subject:to:content-type :content-transfer-encoding; bh=xTlqf1CqkHmMpmf5IIONxnvMJfk+qhjxQnp8ELOvegQ=; b=TefYf7KytHVyi00DHiKgraMkoGDNv/JkkNP+7p1CC/nj43qF5elUjK719vtrdFNxTt C2M2vtZvJCIbXh6HL7XEobYriUUh4jtATUgNE2ENAEk9+aUt132/rdub4iScKnRwsYva DK0txbfEszivCGRC5s9mUkgemSerrxwHfpViU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type:content-transfer-encoding; b=w8sfrsgHVCtQ84Mn5xJHmNtgRhniFlIPF8Z5BRF2kCCFo4s+WPfCte8ltf4gOj9gsp 8thTWBtiwg8cNpuLnbcIe6cbKM/3uvHwkJDRQrjN6Ngps3j+UgF1KO1762KjeiEEcfL2 eXxr/MIXj4178KasJMYH9B2UW4c4aEl9nFCaQ= MIME-Version: 1.0 Received: by 10.86.1.1 with SMTP id 1mr2021398fga.42.1249295318072; Mon, 03 Aug 2009 03:28:38 -0700 (PDT) In-Reply-To: <24788000.post@talk.nabble.com> References: <24753954.post@talk.nabble.com> <24784708.post@talk.nabble.com> <8c4e68610908030232n1831a8c8pe10117e6ca61d2b6@mail.gmail.com> <24788000.post@talk.nabble.com> From: Ian Lea Date: Mon, 3 Aug 2009 11:28:18 +0100 Message-ID: <8c4e68610908030328j40ac2a15w3a9de9e4ce507af9@mail.gmail.com> Subject: Re: Boosting Search Results To: java-user@lucene.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org Sorry, I'm not clear what you don't know how to do. To spell out the double search suggestion a bit more: QueryParser qp =3D new QueryParser(...) Query q1 =3D qp.parse("+word1 +word2"); TopDocs td1 =3D searcher.search(q1, ...) Query q2 =3D qp.parse("word1 word2"); TopDocs td2 =3D searcher.search(q2); ScoreDoc[] sd1 =3D td1.scoreDocs; ScoreDoc[] sd2 =3D td2.scoreDocs; // Grab all docids from first search List docidl =3D new ArrayList(); for (int i1 =3D 0; i1 < sd1.length; i1++) { docidl.add(sd1[i1].doc); } // Add any docids from second search that are not already on the list for (int i2 =3D 0; i2 < sd2.length; i2++) { int docid =3D sd2[i2].doc); if (!docidl.contains(docid)) { docidl.add(docid); } } (code just a suggestion, off the top of my head, may not work, may be full of bugs, there will be other maybe better ways to do it). If that doesn't help, perhaps you could rephrase the question. -- Ian. On Mon, Aug 3, 2009 at 10:51 AM, bourne71 wrote: > > Hey, thanks for the suggestion. > I think of performing 2 searches as well. Unfortunately I dont know how t= o > perform a search on the first results return. Could u guide me a little? = I > tried to look around for the information but found none > > Thanks > > Ian Lea wrote: >> >> You could write your own Similarity, extending DefaultSimilarity and >> overriding whichever methods will help you achieve your aims. >> >> Or how about running 2 searches, the first with both words required >> (+word1 +word2) and then a second search where they aren't both >> required (word1 word2). =A0Then merge/dedup the two lists of hits, >> keeping the ones from the first search at the top. >> >> >> -- >> Ian. >> >> On Mon, Aug 3, 2009 at 4:14 AM, bourne71 wrote: >>> >>> Thanks for all the reply. It help me to understand problem better, but = is >>> it >>> possible to create a query that will give additional boost to the resul= ts >>> if >>> and only if both of the word is found inside the results. This will >>> definitely make sure that the results will be in the higher up of the >>> list. >>> >>> Can this type of query be created? >>> -- >>> View this message in context: >>> http://www.nabble.com/Boosting-Search-Results-tp24753954p24784708.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 >> >> >> > > -- > View this message in context: http://www.nabble.com/Boosting-Search-Resul= ts-tp24753954p24788000.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