Return-Path: Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: (qmail 91192 invoked from network); 20 Nov 2009 16:49:43 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 20 Nov 2009 16:49:43 -0000 Received: (qmail 92818 invoked by uid 500); 20 Nov 2009 16:49:41 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 92709 invoked by uid 500); 20 Nov 2009 16:49:40 -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 92699 invoked by uid 99); 20 Nov 2009 16:49:40 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 20 Nov 2009 16:49:40 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of erickerickson@gmail.com designates 209.85.223.186 as permitted sender) Received: from [209.85.223.186] (HELO mail-iw0-f186.google.com) (209.85.223.186) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 20 Nov 2009 16:49:30 +0000 Received: by iwn16 with SMTP id 16so2656140iwn.29 for ; Fri, 20 Nov 2009 08:49:09 -0800 (PST) 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 :date:message-id:subject:from:to:content-type; bh=SeqYPGrwI+YAFJqZoTDMES53woai+b2elRbua+WdkNU=; b=mQLBpllEbL2GeEY8UMrFqYHU0LU2NfE1pRp5/Q8h8CfhLjrbyLb/5qIVUsRLrNAnO9 vz2IaHWpZCVgPkSCNCV2Lyc22Zftv7zcFNTLG6PB0bbEHEKqmbPU6Rb8MjbYabgEgFvw RCrZoxe006MkTUoVggDS8PPVIPuRgFM9U7VAk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=AOBQNGQA70H28aa28rz+tkztQrL/pZQcak2lKZc+sTragakR5ADzKURkFZqWY7zLa6 tJ8vWBSQQsY+Myu4T2Urur3imu/9AK+3jdX9fnUO7DN8VvwP59QcSXySDWyqCTFpnPRZ j3xN0YTTl3/rMdhJ++Nj3remm84hLIodBzr9Y= MIME-Version: 1.0 Received: by 10.231.29.149 with SMTP id q21mr131276ibc.35.1258735748814; Fri, 20 Nov 2009 08:49:08 -0800 (PST) In-Reply-To: <26442733.post@talk.nabble.com> References: <26421373.post@talk.nabble.com> <8c4e68610911190803m517c2271m9f973e36ad506522@mail.gmail.com> <26442733.post@talk.nabble.com> Date: Fri, 20 Nov 2009 11:49:08 -0500 Message-ID: <359a92830911200849t47649366y513b0ef6c2848cde@mail.gmail.com> Subject: Re: best way to iterate through all docs from a query From: Erick Erickson To: java-user@lucene.apache.org Content-Type: multipart/alternative; boundary=00151774051c2cb0800478d041ff X-Virus-Checked: Checked by ClamAV on apache.org --00151774051c2cb0800478d041ff Content-Type: text/plain; charset=ISO-8859-1 The doc IDs should be consistent *unless* you did anything to the index, things you might not think would change anything. For instance, any kind of commit (assuming you'd ever deleted a document, say). etc. So if you haven't changed your index at all, your doc IDs won't change. But as I said, some operations you don't think would change your doc IDs actually will.... HTH Erick On Fri, Nov 20, 2009 at 10:17 AM, it99 wrote: > > Thanks that helped a lot with the speed!! > I am getting same search results but with different docIds. Is this > expected > and OK? Are they just arbitrar numbers > > If I changed from > Hits hits = mSearcher.search(query, filter); > > > To the following > TopDocCollector collector = new TopDocCollector(1000000); > mSearcher.search(query, filter,collector); > hits = collector.topDocs().scoreDocs; > > > > > > > > Ian Lea wrote: > > > > First queries are often slow and subsequent ones faster. Search the > > list for warming - I think there was something on it in the last > > couple of days. Or read the "When measuring performance, disregard > > the first query" bit of > > http://wiki.apache.org/lucene-java/ImproveSearchingSpeed > > > > A good number to pass to the Collector is however many docs you are > > going to be interested in. If you are just going to display the first > > 10, pass 10. > > > > > > -- > > Ian. > > > > > > On Thu, Nov 19, 2009 at 3:36 PM, it99 wrote: > >> > >> What is the best way to iterate across all the documents in a search > >> results? > >> Previously I was using the deprecated Hits object but changed the > >> implentations as recommended in javadocs to ScoreDoc. > >> > >> I've tried the following but I've seen warning about peformance. > >> Seems the first time I query something it takes long time and then after > >> that it is quick. > >> > >> > >> > >> for (int i = 0; i < mNumberOfHits; i++) > >> { > >> > >> int docId = hits[i].doc; > >> Document doc = searcher.doc(docId); > >> } > >> > >> Here's the code for the search > >> What is good number to pass intot TopDocCollector? > >> > >> TopDocCollector collector = new TopDocCollector(1000000); > >> searcher.search(query, collector); > >> ScoreDoc[] hits = collector.topDocs().scoreDocs; > >> -- > >> View this message in context: > >> > http://old.nabble.com/best-way-to-iterate-through-all-docs-from-a-query-tp26421373p26421373.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://old.nabble.com/best-way-to-iterate-through-all-docs-from-a-query-tp26421373p26442733.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 > > --00151774051c2cb0800478d041ff--