Return-Path: Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: (qmail 77234 invoked from network); 7 Dec 2006 18:24:33 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 7 Dec 2006 18:24:33 -0000 Received: (qmail 53293 invoked by uid 500); 7 Dec 2006 18:24:28 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 53262 invoked by uid 500); 7 Dec 2006 18:24:28 -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 53241 invoked by uid 99); 7 Dec 2006 18:24:28 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 07 Dec 2006 10:24:28 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of grant.ingersoll@gmail.com designates 72.14.246.248 as permitted sender) Received: from [72.14.246.248] (HELO ag-out-0708.google.com) (72.14.246.248) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 07 Dec 2006 10:24:14 -0800 Received: by ag-out-0708.google.com with SMTP id 9so219489agd for ; Thu, 07 Dec 2006 10:23:54 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:mime-version:in-reply-to:references:content-type:message-id:content-transfer-encoding:from:subject:date:to:x-mailer; b=HG1ci5vf25zWDDeFKIlzbYAEVpRynG1b9UVFi/jQ/AdBMznsMxVcKJzcxpTToTgESprnNRLBYwxDpUo62z3D2KorLy2R3QjTQKOUWSYQyiS7aivXK5YGJS+nbaTZFWe3tKWeB0j10cUhPWzQoEXh+evPyhHfL+at1Si2/1gT3jk= Received: by 10.100.163.12 with SMTP id l12mr2613001ane.1165515834127; Thu, 07 Dec 2006 10:23:54 -0800 (PST) Received: from ?192.168.0.2? ( [74.229.189.244]) by mx.google.com with ESMTP id 14sm2427471wrl.2006.12.07.10.23.53; Thu, 07 Dec 2006 10:23:53 -0800 (PST) Mime-Version: 1.0 (Apple Message framework v752.2) In-Reply-To: <6B6D3063DF0A7A4DB8A989D40C61BEB3027FF0EC@EMAIL02.wescodist.com> References: <6B6D3063DF0A7A4DB8A989D40C61BEB3027FF0EC@EMAIL02.wescodist.com> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: Content-Transfer-Encoding: 7bit From: Grant Ingersoll Subject: Re: Reading Performance Date: Thu, 7 Dec 2006 13:23:50 -0500 To: java-user@lucene.apache.org X-Mailer: Apple Mail (2.752.2) X-Virus-Checked: Checked by ClamAV on apache.org Have you done any profiling to identify hotspots in Lucene versus your application? You might look into the FieldSelector code (used in IndexReader) in the Trunk version of Lucene could be used to only load the fields you are interested when getting the document from disk. This can be useful if you have large fields that are being loaded that you don't necessarily need (thus skipping them). Also, do you need the BufferedWriter construction and check in side the loop? Probably small in comparison to loading, but It seems like it is only created once, why have it in the loop? On Dec 7, 2006, at 1:14 PM, Aigner, Thomas wrote: > > > > > Howdy all, > > > > I have a question on reading many documents and time to do this. > I have a loop on the hits object reading a record, then writing it > to a > file. When there is only 1 user on the Index Searcher, this > process to > read say 100,000 takes around 3 seconds. This is slow, but can be > acceptable. When a few more users do searchers, this time to just > read > from the hits object becomes well over 10 seconds, sometimes even 30+ > seconds. Is there a better way to read through and do something with > the hits information? And yes, I have to read all of them to do this > particular task. > > > > for (int i = 0;(i <= hits.length() - 1); i++) > > { > > > > if (fw == null) > > { > > fw = new BufferedWriter( new FileWriter > ( searchWriteSpec ), > 8196) ; > > } > > > > //Write Out records > > String tmpHold = ""; > > tmpHold = hits.doc(i).get("somefield1") + hits.doc(i).get > ("somefield2"); > > > > fw.write(tmpHold + "\n" ); > > > > } > > > > Any ideas on how to speed this up especially with multiple users? > Each > user gets their own class which has the above code in it. > > > > Thanks, > > Tom > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > ------------------------------------------------------ Grant Ingersoll http://www.grantingersoll.com/ --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org For additional commands, e-mail: java-user-help@lucene.apache.org