Return-Path: Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: (qmail 8367 invoked from network); 22 Dec 2009 12:06:04 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 22 Dec 2009 12:06:04 -0000 Received: (qmail 65397 invoked by uid 500); 22 Dec 2009 12:05:45 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 65358 invoked by uid 500); 22 Dec 2009 12:05:44 -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 65348 invoked by uid 99); 22 Dec 2009 12:05:43 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 22 Dec 2009 12:05:43 +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 antonv.kirillov@gmail.com designates 72.14.220.152 as permitted sender) Received: from [72.14.220.152] (HELO fg-out-1718.google.com) (72.14.220.152) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 22 Dec 2009 12:05:35 +0000 Received: by fg-out-1718.google.com with SMTP id 16so266776fgg.5 for ; Tue, 22 Dec 2009 04:05:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=I9+omdfuEoXA48RYEHTyBRAgjogKLndTeIgS6ihPMqI=; b=B1RUmlbIpK4v0vUk+zCj81BcBoX2vBb+49LXQ8FP0g1F8TK3zKddXCPME33t75Qdiq CryfRESsOqk2J2Zt9z/x1MqcF6WNZvbGtuSyZPmzR4J+3CxDPB5tESWV+nsrqnh0mr2K MdUodZ0GDD0kY3NgROL3yHtWcvpA0gbX4IuIM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=gDxoHq/eAoXodEsha9O5E+R5bR1HIIiSimolikKzZ30XBWNMvLWNqi5H7nfcooP3ed Oyh2sDU/nU5EpfbX1ORkGc+AXdiDu8Atnw4gynNcQeW28OgKwYlltXwUtDb5Z75lHVrQ 1QhDwOx5GsnRExlbumWJmzKzU5BJu91fgSRts= MIME-Version: 1.0 Received: by 10.87.42.37 with SMTP id u37mr700358fgj.68.1261483515408; Tue, 22 Dec 2009 04:05:15 -0800 (PST) In-Reply-To: <8c4e68610912210751pd2f602fn71f2447b3ebeafc7@mail.gmail.com> References: <9a76536b0912210426x7ad12c4aub6457de5750c7221@mail.gmail.com> <8c4e68610912210751pd2f602fn71f2447b3ebeafc7@mail.gmail.com> Date: Tue, 22 Dec 2009 15:05:15 +0300 Message-ID: <9a76536b0912220405i295390f2j94bbf482a957467f@mail.gmail.com> Subject: Re: Lucene' results paging From: =?UTF-8?B?0JDQvdGC0L7QvSDQmtC40YDQuNC70LvQvtCy?= To: java-user@lucene.apache.org Content-Type: text/plain; charset=KOI8-R Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org Thanks for your answer. But how should I get the total nubmer of search results in this case? On Mon, Dec 21, 2009 at 6:51 PM, Ian Lea wrote: > Hi > > > The standard approach to paging is just to do the search again and > pick out the docs you want, along the lines you outline. =9AYou cannot > pass start/end info to any search methods. > > When you set max doc to, say, 10, lucene will find the 10 highest > scoring docs and return them. =9AThere is no point in passing a number > higher than you need. =9ASo if you are displaying 10 hits per page, call > search(query, 10) for the first page, ..., 20 for the second and pick > out the last 10, and so on. > > An alternative approach is for you to cache the search results > yourself. =9AThat way you can avoid any subsequent searches. =9ABut that > has it's own overhead and complexity, and most people most of the time > don't get much past the first page. > > > http://wiki.apache.org/lucene-java/LuceneFAQ#How_do_I_implement_paging.2C= _i.e._showing_result_from_1-10.2C_11-20_etc.3F > > -- > Ian. > > > On Mon, Dec 21, 2009 at 12:26 PM, =E1=CE=D4=CF=CE =EB=C9=D2=C9=CC=CC=CF= =D7 > wrote: >> Hi, All! I have some problems with Lucene's search process and it's >> results, so I hope You could help me. >> >> First one: how should I split results by pages? Now I get search >> results in such way: >> >> TopDocs topDocs =3D is.search(finalQuery, 100000) //For example >> >> and after that I get the needed results in such way: >> >> //for example startPage =3D 20, endPage =3D 40 >> for(int j=3DstartPage; j> >> doc[j-startPage] =3D is.doc(topDocs.scoreDocs[j].doc); >> } >> >> I think this is a bad approach. How should I optimize my code to make >> search faster? Is there any possibility to set start and stop pages in >> search methods? >> >> The second one: >> After the search is completed and the results are not sorted are all >> the results stored in search engine? I mean when I set the max number >> of docs in method search(finalQuery, 10) equal 10. would Lucene find >> all relevant docs, then sort them by relevance and select first ten >> after that? Or does Lucene store some specific information in indices >> which allows select first 10 most relevant docs without sorting all >> million (for example) relevant pages? >> >> Thanks in advance. >> -- >> Anton Kirillov >> >> --------------------------------------------------------------------- >> 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 > > --=20 =F3 =D5=D7=C1=D6=C5=CE=C9=C5=CD, =EB=C9=D2=C9=CC=CC=CF=D7 =E1=CE=D4=CF=CE --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org For additional commands, e-mail: java-user-help@lucene.apache.org