Return-Path: Delivered-To: apmail-jakarta-lucene-user-archive@www.apache.org Received: (qmail 39108 invoked from network); 29 Jun 2004 20:14:15 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 29 Jun 2004 20:14:15 -0000 Received: (qmail 41688 invoked by uid 500); 29 Jun 2004 20:14:19 -0000 Delivered-To: apmail-jakarta-lucene-user-archive@jakarta.apache.org Received: (qmail 41608 invoked by uid 500); 29 Jun 2004 20:14:17 -0000 Mailing-List: contact lucene-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Lucene Users List" Reply-To: "Lucene Users List" Delivered-To: mailing list lucene-user@jakarta.apache.org Received: (qmail 41586 invoked by uid 99); 29 Jun 2004 20:14:17 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from [64.80.12.100] (HELO bass.Textwise.com) (64.80.12.100) by apache.org (qpsmtpd/0.27.1) with ESMTP; Tue, 29 Jun 2004 13:14:17 -0700 Received: from [172.18.1.105] ([172.18.1.105]) by bass.Textwise.com (8.11.6+Sun/8.9.3) with ESMTP id i5TKE2Q27346 for ; Tue, 29 Jun 2004 16:14:02 -0400 (EDT) Subject: Re: Is there any way to Collect all the searched documents at once? From: Anthony Vito To: Lucene Users List In-Reply-To: <20040629090845.41616.qmail@web8301.mail.in.yahoo.com> References: <20040629090845.41616.qmail@web8301.mail.in.yahoo.com> Content-Type: text/plain Organization: PPI Message-Id: <1088540127.5024.145.camel@mortal> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) Date: Tue, 29 Jun 2004 16:15:28 -0400 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N > Is there any way to fetch the fields of the searched > documents at once rather than looping through the > found documents one by one....because it consumes lots > of time and time increases by magnitude if the no. of > documents found are more. > > This is how I am fetching the found documents .. > > count=1500000 (no. of documents found) > > for(int i=0 ; i < count;i++ ) > { > Document doc = > hits.doc(i); > fields[i] = > Long.parseLong(doc.get("FIELD")); > } > > This takes around 2.5 minutes for fetching 1500000 > records which is unacceptable. > > Regards > Karan 1.5 million in 2.5 minutes gives me 100 microseconds per iteration. ( correct me if I messed up the math. ) I'd be willing to bet the Long.parseLong() is a significant part of that time because it iterates through each character. You should profile your code, a simple -Xrunhprof:cpu=samples should suffice. If the parse is a significant percentage of total run time, > 30% or so. You can save iterations in the parse by encoding and decoding using a very high radix, probably 36, so it would be alphanumeric. -vito --------------------------------------------------------------------- To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: lucene-user-help@jakarta.apache.org