Return-Path: X-Original-To: apmail-lucene-java-user-archive@www.apache.org Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 9796810AD7 for ; Wed, 19 Jun 2013 07:40:19 +0000 (UTC) Received: (qmail 65552 invoked by uid 500); 19 Jun 2013 07:40:17 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 65355 invoked by uid 500); 19 Jun 2013 07:40:14 -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 65293 invoked by uid 99); 19 Jun 2013 07:40:13 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 19 Jun 2013 07:40:13 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of ping.swapnil@gmail.com designates 209.85.215.52 as permitted sender) Received: from [209.85.215.52] (HELO mail-la0-f52.google.com) (209.85.215.52) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 19 Jun 2013 07:40:07 +0000 Received: by mail-la0-f52.google.com with SMTP id fo12so4256350lab.25 for ; Wed, 19 Jun 2013 00:39:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=7Z72+J5palJ6kCGn3hkrWFFjn2W/W9+H9O0umMq3SZQ=; b=gygeTZQHHTa9gSGk5BwlrB5XHZwXdPK/MuDiYMY63hPC1HlHB1rM3yTsJojXHSqXQq CkMVcgSILUnBg/CiRkr/82KV4QILIOuVQTNCoPqHC6fu1669iuSTD8m4qvhVTE/OyFeR F+3ShfuzJPsJHuHarvCo3I9QsspkLFmWbGD55Seqb/rKOxuJzOYD69VQA0UcRW3YUfuZ gVeGDmvIK0nT5WT/4n/oyJhQWhZ6X3fT86oO5N0ocXK+vRv2zQQvE3Nfp7lqTsCyrjPC buVN5xJTOOnz+XAKyMD9h9RE9OGlk5ewRruMlE918+z0L48jCHXAm3qWC2hR7s/Kw0ij 7K4Q== MIME-Version: 1.0 X-Received: by 10.152.87.43 with SMTP id u11mr712842laz.71.1371627586464; Wed, 19 Jun 2013 00:39:46 -0700 (PDT) Received: by 10.112.59.70 with HTTP; Wed, 19 Jun 2013 00:39:46 -0700 (PDT) In-Reply-To: References: Date: Wed, 19 Jun 2013 15:39:46 +0800 Message-ID: Subject: Re: how to reterieve all results from lucene searcher.search() method From: Swapnil Patil To: java-user@lucene.apache.org Content-Type: multipart/alternative; boundary=001a11c22a280e2f0b04df7cef9e X-Virus-Checked: Checked by ClamAV on apache.org --001a11c22a280e2f0b04df7cef9e Content-Type: text/plain; charset=ISO-8859-1 you can get all results for given query "q". By giving documents to fetch a very big number like Integer.MAX_VALUE. But if u want to loop over all documents. Use index reader and get document by its doc id from 0 to numDocs (Index reader has method for num docs). On Wed, Jun 19, 2013 at 3:11 PM, neeraj shah wrote: > hello, > > Is there any way to get all the search result. > In lucene we get top documents by giving the limit like top 100,1000... > etc. > but if i want to get all results. > > How can I achieve that?? > > Query qu = new QueryParser(Version.LUCENE_36,"field", > analyzer).parse(query); > > TopDocs hits = searcher.search(qu,1000); > --001a11c22a280e2f0b04df7cef9e--