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 5CEED1197A for ; Tue, 3 Jun 2014 08:55:09 +0000 (UTC) Received: (qmail 64473 invoked by uid 500); 3 Jun 2014 08:55:08 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 64407 invoked by uid 500); 3 Jun 2014 08:55:07 -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 64396 invoked by uid 99); 3 Jun 2014 08:55:07 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 03 Jun 2014 08:55:07 +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 vfunstein@gmail.com designates 74.125.82.182 as permitted sender) Received: from [74.125.82.182] (HELO mail-we0-f182.google.com) (74.125.82.182) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 03 Jun 2014 08:55:02 +0000 Received: by mail-we0-f182.google.com with SMTP id t60so6287587wes.41 for ; Tue, 03 Jun 2014 01:54:41 -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=kxxhewnsbT2e1cl7a02a5Q55IqbfbS+OmEfyKTZ6fa0=; b=yz8O1Sa+dyAhyCQNzfM1o9WnDbnBmwyfIOoaVhzuqmT4mLXUlJvJncFELK9buI3l7o jocc/25ATnpEUzszjoJDcmgnfVHTRWUN4KSKIcdsxJL31qwfZKf5VeDFCPElqNU/wXd+ yjVUhVnDPCFbvbQBDPYSVfyza3P4O9YVX7cznWTuHNL66LZLRX8yevaku41xXrMbh0Iv 6BW9R/bY3a6JZdpGcUatveO4UT1gZOqp4XWTslQKw4NZTJtG0S0dZE/WZ1LbUoP1G2HR 9pMbwChd12pVX23DH6mVtOH2ccTutTyQyeOBqaVs9pWdXkBLxwoIE37mSIHJqeW2ddXa OT+Q== MIME-Version: 1.0 X-Received: by 10.180.99.166 with SMTP id er6mr30846169wib.48.1401785680176; Tue, 03 Jun 2014 01:54:40 -0700 (PDT) Received: by 10.194.62.206 with HTTP; Tue, 3 Jun 2014 01:54:40 -0700 (PDT) In-Reply-To: <538C5174.7040101@mailarchiva.com> References: <01AFE0FB733B9944974A82A09CEB7A0309C81ABB21@mail3.imedx.com> <1400570841.2420.155.camel@te-prime> <01AFE0FB733B9944974A82A09CEB7A0309C835D126@mail3.imedx.com> <1400578244.2420.170.camel@te-prime> <01AFE0FB733B9944974A82A09CEB7A0309C835D16A@mail3.imedx.com> <1400581087.2420.182.camel@te-prime> <01AFE0FB733B9944974A82A09CEB7A0309C835D36D@mail3.imedx.com> <1401153243448-4138215.post@n3.nabble.com> <003301cf7974$7a200600$6e601200$@gmx.de> <01AFE0FB733B9944974A82A09CEB7A0309C881E6CF@mail3.imedx.com> <538C1F0F.3010300@mailarchiva.com> <538C5174.7040101@mailarchiva.com> Date: Tue, 3 Jun 2014 01:54:40 -0700 Message-ID: Subject: Re: search performance From: Vitaly Funstein To: java-user@lucene.apache.org Content-Type: multipart/alternative; boundary=f46d04428ef684ad8804faeaa96c X-Virus-Checked: Checked by ClamAV on apache.org --f46d04428ef684ad8804faeaa96c Content-Type: text/plain; charset=UTF-8 Something doesn't quite add up. TopFieldCollector fieldCollector = TopFieldCollector.create(sort, max,true, > false, false, true); > > We use pagination, so only returning 1000 documents or so at a time. > > You say you are using pagination, yet the API you are using to create your collector isn't how you would utilize Lucene's built-in "pagination" feature (unless misunderstand the API). If the max is the snippet above is 1000, then you're simply returning top 1000 docs every time you execute your search. Otherwise... well, could you actually post a bit more of your code that runs the search here, in particular? Assuming that the max is much larger than 1000, however, you could call fieldCollector.topDocs(int, int) after accumulating hits using this collector, but this won't work multiple times per query execution, according to the javadoc. So you either have to re-execute the full search, and then get the next chunk of ScoreDocs, or use the proper API for this, one that accepts as a parameter the end of the previous page of results, i.e. IndexSearcher.searchAfter(ScoreDoc, ...) --f46d04428ef684ad8804faeaa96c--