Return-Path: Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: (qmail 64524 invoked from network); 20 Mar 2009 17:59:17 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 20 Mar 2009 17:59:17 -0000 Received: (qmail 16562 invoked by uid 500); 20 Mar 2009 17:59:09 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 16537 invoked by uid 500); 20 Mar 2009 17:59: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 16526 invoked by uid 99); 20 Mar 2009 17:59:09 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 20 Mar 2009 10:59:09 -0700 X-ASF-Spam-Status: No, hits=2.0 required=10.0 tests=RCVD_IN_BL_SPAMCOP_NET,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of aminmc@gmail.com designates 72.14.220.155 as permitted sender) Received: from [72.14.220.155] (HELO fg-out-1718.google.com) (72.14.220.155) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 20 Mar 2009 17:58:59 +0000 Received: by fg-out-1718.google.com with SMTP id 19so319504fgg.4 for ; Fri, 20 Mar 2009 10:58:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:references:message-id:from:to :in-reply-to:content-type:content-transfer-encoding:x-mailer :mime-version:subject:date:cc; bh=Y+vzSp650ywXM7M+C6BSjgGm6RlpBT9ZJWwdeMfj+Uo=; b=Zx6dGAsziaCE5u6lLdlRp8v/Kr49zUKMapnCKkuzEMahI8v7UqRR/XqdkuBhOeWN9e W8gD5GvYa1p32aPH4kXAhEUKWEWuZiYfGwmbu3jgzziY8rRPPMtnAQZfTuuGt6D/vXGb e8+HaKjVEQs5V+hWVnlx1obsAkpSPWbDcJA0w= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=references:message-id:from:to:in-reply-to:content-type :content-transfer-encoding:x-mailer:mime-version:subject:date:cc; b=EfBbqpCcQRb0r5iXWaH3KuUqV1TxhvvpHXFSFWjPTB0CmYGbPkmz3tNwIAZYqxW8RA x1wzTLiJAuRCJV1WR2U4bCBe5xwY+VihuWyKN1ZKs288wKK7+OLNWaObIRleek02w3qa Au0F5bp+pLROZ7fHmsJrTsyC5VY02bNqy5h7w= Received: by 10.86.53.11 with SMTP id b11mr1739919fga.70.1237571918793; Fri, 20 Mar 2009 10:58:38 -0700 (PDT) Received: from ?10.40.30.213? ([82.132.136.209]) by mx.google.com with ESMTPS id d6sm4219427fga.22.2009.03.20.10.58.25 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 20 Mar 2009 10:58:38 -0700 (PDT) References: <49C3CC0E.1090700@fastmail.fm> <9841F2AA-A881-4C9F-8A4F-F8E38D14119F@gmail.com> Message-Id: From: Amin Mohammed-Coleman To: "java-user@lucene.apache.org" In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit X-Mailer: iPhone Mail (5H11) Mime-Version: 1.0 (iPhone Mail 5H11) Subject: Re: Performance tips on searching Date: Fri, 20 Mar 2009 17:57:58 +0000 Cc: "" X-Virus-Checked: Checked by ClamAV on apache.org Hi I wrote last week about the best way to paginate. I will reply back with that email if that ok. This isn't my thread and I don't want to deviate from the original topic. Cheers Amin On 20 Mar 2009, at 17:50, "Uwe Schindler" wrote: > No, the MultiSearcher also exposes all methods, IndexSearcher/Seracher > exposes (it inherits it from the superclass IndexSearcher). And a > call to > the collector is never sortable, because the sorting is done > *inside* the > hit collector. > > Where is your problem with pagination? Normally you choose n to be > paginationoffset+count and then display Scoredocs between n .. n > +count-1. > There is no TopDocCollector that can only collect results 100 to > 109. To > display results 100 to 109, you need to collect all results up to > 109, so > call with n=110 and then display scoredoc[100]..scoredoc[109] > > This is exactly how the old Hits worked. > > ----- > Uwe Schindler > H.-H.-Meier-Allee 63, D-28213 Bremen > http://www.thetaphi.de > eMail: uwe@thetaphi.de > > >> -----Original Message----- >> From: Amin Mohammed-Coleman [mailto:aminmc@gmail.com] >> Sent: Friday, March 20, 2009 6:43 PM >> To: java-user@lucene.apache.org >> Cc: ; >> Subject: Re: Performance tips on searching >> >> Hi >> >> How do you expose a pagination without a customized hit collector. >> The >> multi searcher does not expose a method for hit collector and sort. >> Maybe this is not an issue for people ... >> >> Cheers >> >> Amin >> >> On 20 Mar 2009, at 17:25, "Uwe Schindler" wrote: >> >>> Why not use a MultiSearcher an all single searchers? Or a Searcher >>> on a >>> MultiReader consisting of all IndexReaders? With that you do not >>> need to >>> merge the results. >>> >>> By the way: instead of creating a TopDocCollector, you could also >>> call >>> directly, >>> >>> Searcher.search(Query query, Filter filter, int n, Sort sort) >>> Searcher.search(Query query, Filter filter, int n) >>> >>> Filter can be null. >>> >>> It's shorter and if sorting is also involved, simplier to handle >>> (you do not >>> need to switch between ToDocCollector and TopFieldDocCollector). >>> >>> Important: With Lucene 2.9, the searches will be faster using this >>> API >>> (because then each index segment uses an own collector). >>> >>> Uwe >>> >>> >>> ----- >>> Uwe Schindler >>> H.-H.-Meier-Allee 63, D-28213 Bremen >>> http://www.thetaphi.de >>> eMail: uwe@thetaphi.de >>> >>>> -----Original Message----- >>>> From: Paul Taylor [mailto:paul_t100@fastmail.fm] >>>> Sent: Friday, March 20, 2009 6:02 PM >>>> To: java-user@lucene.apache.org >>>> Subject: Performance tips on searching >>>> >>>> >>>> Hi, my code receives a search query from the web, there are 5 >>>> different >>>> searches that can be searched on - each index is searched with a >>>> single >>>> IndexSearcher referenced in a map. it parses then performs the >>>> search >>>> and return the best 10 results, with scores readjusted over the >>>> results >>>> so that the best score returns 1.0. Am I performing the optiminal >>>> search >>>> methods to do what I want ? >>>> >>>> thanks Paul >>>> >>>> IndexSearcher searcher = searchers.get(indexName); >>>> QueryParser parser = new QueryParser(indexName, analyzer); >>>> TopDocCollector collector = new TopDocCollector(10); >>>> try { >>>> searcher.search(parser.parse(query), collector); >>>> } >>>> catch (ParseException e) { >>>> } >>>> Results results = new Results(); >>>> results.totalHits = collector.getTotalHits(); >>>> TopDocs topDocs = collector.topDocs(); >>>> ScoreDoc docs[] = topDocs.scoreDocs; >>>> float maxScore = topDocs.getMaxScore(); >>>> for (int i = 0; i < docs.length; i++) { >>>> Result result = new Result(); >>>> result.score = docs[i].score / maxScore; >>>> result.doc = searcher.doc(docs[i].doc); >>>> results.results.add(result); >>>> } >>>> return results; >>>> >>>> --- >>>> ------------------------------------------------------------------ >>>> 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 > > > > --------------------------------------------------------------------- > 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