Return-Path: Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: (qmail 41535 invoked from network); 29 Jun 2009 16:47:18 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 29 Jun 2009 16:47:18 -0000 Received: (qmail 24365 invoked by uid 500); 29 Jun 2009 16:47:26 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 24324 invoked by uid 500); 29 Jun 2009 16:47:26 -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 24314 invoked by uid 99); 29 Jun 2009 16:47:26 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 29 Jun 2009 16:47:26 +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 simon.willnauer@googlemail.com designates 209.85.210.182 as permitted sender) Received: from [209.85.210.182] (HELO mail-yx0-f182.google.com) (209.85.210.182) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 29 Jun 2009 16:47:14 +0000 Received: by yxe12 with SMTP id 12so1326627yxe.29 for ; Mon, 29 Jun 2009 09:46:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:mime-version:received:reply-to:in-reply-to :references:date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=doLRcDp6PMGyAgd1pKin/PuQz5FEDktkHUxKBgRnJ8g=; b=FScmgSaqgFSwp4g9U4XMQhb00HtbuCfx8aUi+IGQMOf2QnXOuPNYk0Ll7QXQx4rzwn monuOXTN3s9Ekr/eB8PQVhq4PAPAkUE9I8l6v2tO4wy5rnWqF2Ugi/lnuUvr1ME31gKG cM0USX3R9FA1dgBCbKklepG8Fg75doldj8V0I= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=mime-version:reply-to:in-reply-to:references:date:message-id :subject:from:to:content-type:content-transfer-encoding; b=DlGVK522J+YgN3cerxciHeJKuN9+j930JL9VfunLZGvOxv1o2Da6rO3ZwuQP1Tgu1g 8WjxsWwhbBsQTPJ2ZBKTvj0Ldk8zS5FHWMz1CtHvAqYbp/F/IpVpizUqhNHrKA0BLs0f 3O9afeNXoTOJMsARAhM6XSC7Xk+oVaVYnOMv0= MIME-Version: 1.0 Received: by 10.100.154.14 with SMTP id b14mr9386841ane.142.1246294009370; Mon, 29 Jun 2009 09:46:49 -0700 (PDT) Reply-To: simon.willnauer@gmail.com In-Reply-To: <24257547.post@talk.nabble.com> References: <24251993.post@talk.nabble.com> <24253338.post@talk.nabble.com> <24253583.post@talk.nabble.com> <24253760.post@talk.nabble.com> <24254191.post@talk.nabble.com> <24257547.post@talk.nabble.com> Date: Mon, 29 Jun 2009 18:46:46 +0200 Message-ID: Subject: Re: Read large size index From: Simon Willnauer To: java-user@lucene.apache.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org On Mon, Jun 29, 2009 at 6:36 PM, m.harig wrote: > > Thanks Simon , > > Hey there, that makes things easier. :) > > ok here are some questions: > >>>>Do you iterate over all docs calling hits.doc(i) ?If so do you have to > load all fields to render your results, if not you should not retrieve > all of them? > > > Yes, am iterating over all docs by calling hits.doc(i) , do you really need to get all docs? wouldn't it be enough to fetch just the top N you want to display or do you want to display all of them? > > > > You use IndexSearchersearch(Query q,...) which returns a Hits object > have you tried to use the new search methods returning TopDocs? > > Sorry, i didn't , could you please send me a piece of code. Example: IndexReader open = IndexReader.open("/tmp/testindex/"); IndexSearcher searcher = new IndexSearcher(open); final String fName = "test"; TopDocs topDocs = searcher.search(new TermQuery(new Term(fName, "lucene")), Integer.MAX_VALUE); FieldSelector selector = new FieldSelector() { public FieldSelectorResult accept(String fieldName) { return fieldName == fName ? FieldSelectorResult.LOAD : FieldSelectorResult.NO_LOAD; } }; final int totalHits = topDocs.totalHits; ScoreDoc[] scoreDocs = topDocs.scoreDocs; for (int i = 0; i < totalHits; i++) { Document doc = searcher.doc(scoreDocs[i].doc, selector); } > > when you search for pdf and get 30k results you load all the "stored" > field content into memory once you call IndexSearcher.doc(i) as it > internally calls IndexReader.document(i, null). This is equivalent to > a "Load All fields" FieldSelector. > You can have a closer look at FieldSelector and the new search methods > which accept them. This is a way to make you retrieval faster and load > only the fields you really need. > > > > -- > View this message in context: http://www.nabble.com/Read-large-size-index-tp24251993p24257547.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