Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Lucene: Java-User

Lucene Pagination with Query

 

 

Lucene java-user RSS feed   Index | Next | Previous | View Threaded


yogeshpateldaiict at gmail

May 12, 2012, 3:12 AM

Post #1 of 4 (277 views)
Permalink
Lucene Pagination with Query

Hi

I have index 100000 documents in Lucene. I have one query that gets all
documents and it takes more time..
So i need to implement paging in lucene query so i can search result fast
page wise.

Is it possible to do paging or smart rendering with Lucene.

Awaiting for reply.

--
Yogesh Patel


loujanwen at gmail

May 12, 2012, 4:17 AM

Post #2 of 4 (271 views)
Permalink
Re: Lucene Pagination with Query [In reply to]

Yes.You can use the method:

publicTopFieldDocs <http://lucene.apache.org/core/3_6_0/api/core/org/apache/lucene/search/TopFieldDocs.html> search(Query <http://lucene.apache.org/core/3_6_0/api/core/org/apache/lucene/search/Query.html> query,
Filter <http://lucene.apache.org/core/3_6_0/api/core/org/apache/lucene/search/Filter.html> filter,
int n,
Sort <http://lucene.apache.org/core/3_6_0/api/core/org/apache/lucene/search/Sort.html> sort)
throwsIOException <http://download.oracle.com/javase/1.5.0/docs/api/java/io/IOException.html?is-external=true>

see the api at http://lucene.apache.org/core/3_6_0/api/core/org/apache/lucene/search/IndexSearcher.html




On 2012-5-12 18:12, Yogesh patel wrote:
> Hi
>
> I have index 100000 documents in Lucene. I have one query that gets all
> documents and it takes more time..
> So i need to implement paging in lucene query so i can search result fast
> page wise.
>
> Is it possible to do paging or smart rendering with Lucene.
>
> Awaiting for reply.
>


yogeshpateldaiict at gmail

May 12, 2012, 4:27 AM

Post #3 of 4 (273 views)
Permalink
Re: Lucene Pagination with Query [In reply to]

But is it possible to get results from between 200 to 300 documents with
lucene query when i click on third page number?

On Sat, May 12, 2012 at 4:47 PM, janwen <loujanwen [at] gmail> wrote:

> Yes.You can use the method:
>
> publicTopFieldDocs <http://lucene.apache.org/**core/3_6_0/api/core/org/**
> apache/lucene/search/**TopFieldDocs.html<http://lucene.apache.org/core/3_6_0/api/core/org/apache/lucene/search/TopFieldDocs.html>>
> search(Query <http://lucene.apache.org/**core/3_6_0/api/core/org/**
> apache/lucene/search/Query.**html<http://lucene.apache.org/core/3_6_0/api/core/org/apache/lucene/search/Query.html>>
> query,
> Filter <http://lucene.apache.org/**
> core/3_6_0/api/core/org/**apache/lucene/search/Filter.**html<http://lucene.apache.org/core/3_6_0/api/core/org/apache/lucene/search/Filter.html>>
> filter,
> int n,
> Sort <http://lucene.apache.org/**
> core/3_6_0/api/core/org/**apache/lucene/search/Sort.html<http://lucene.apache.org/core/3_6_0/api/core/org/apache/lucene/search/Sort.html>
> **> sort)
> throwsIOException <http://download.oracle.com/**
> javase/1.5.0/docs/api/java/io/**IOException.html?is-external=**true<http://download.oracle.com/javase/1.5.0/docs/api/java/io/IOException.html?is-external=true>
> >
>
> see the api at http://lucene.apache.org/core/**3_6_0/api/core/org/apache/*
> *lucene/search/IndexSearcher.**html<http://lucene.apache.org/core/3_6_0/api/core/org/apache/lucene/search/IndexSearcher.html>
>
>
>
>
>
> On 2012-5-12 18:12, Yogesh patel wrote:
>
>> Hi
>>
>> I have index 100000 documents in Lucene. I have one query that gets all
>> documents and it takes more time..
>> So i need to implement paging in lucene query so i can search result fast
>> page wise.
>>
>> Is it possible to do paging or smart rendering with Lucene.
>>
>> Awaiting for reply.
>>
>>
>


--
Yogesh Patel
**
Jr. Software Engineer,
HighQSolutions


loujanwen at gmail

May 12, 2012, 6:22 AM

Post #4 of 4 (271 views)
Permalink
Re: Lucene Pagination with Query [In reply to]

That method is for your situation.See the javadoc api for more details.


searchAfter

publicTopDocs <http://lucene.apache.org/core/3_6_0/api/core/org/apache/lucene/search/TopDocs.html> searchAfter(ScoreDoc <http://lucene.apache.org/core/3_6_0/api/core/org/apache/lucene/search/ScoreDoc.html> after,
Query <http://lucene.apache.org/core/3_6_0/api/core/org/apache/lucene/search/Query.html> query,
int n)
throwsIOException <http://download.oracle.com/javase/1.5.0/docs/api/java/io/IOException.html?is-external=true>



On 2012-5-12 19:27, Yogesh patel wrote:
> But is it possible to get results from between 200 to 300 documents with
> lucene query when i click on third page number?
>
> On Sat, May 12, 2012 at 4:47 PM, janwen<loujanwen [at] gmail> wrote:
>
>> Yes.You can use the method:
>>
>> publicTopFieldDocs<http://lucene.apache.org/**core/3_6_0/api/core/org/**
>> apache/lucene/search/**TopFieldDocs.html<http://lucene.apache.org/core/3_6_0/api/core/org/apache/lucene/search/TopFieldDocs.html>>
>> search(Query<http://lucene.apache.org/**core/3_6_0/api/core/org/**
>> apache/lucene/search/Query.**html<http://lucene.apache.org/core/3_6_0/api/core/org/apache/lucene/search/Query.html>>
>> query,
>> Filter<http://lucene.apache.org/**
>> core/3_6_0/api/core/org/**apache/lucene/search/Filter.**html<http://lucene.apache.org/core/3_6_0/api/core/org/apache/lucene/search/Filter.html>>
>> filter,
>> int n,
>> Sort<http://lucene.apache.org/**
>> core/3_6_0/api/core/org/**apache/lucene/search/Sort.html<http://lucene.apache.org/core/3_6_0/api/core/org/apache/lucene/search/Sort.html>
>> **> sort)
>> throwsIOException<http://download.oracle.com/**
>> javase/1.5.0/docs/api/java/io/**IOException.html?is-external=**true<http://download.oracle.com/javase/1.5.0/docs/api/java/io/IOException.html?is-external=true>
>> see the api at http://lucene.apache.org/core/**3_6_0/api/core/org/apache/*
>> *lucene/search/IndexSearcher.**html<http://lucene.apache.org/core/3_6_0/api/core/org/apache/lucene/search/IndexSearcher.html>
>>
>>
>>
>>
>>
>> On 2012-5-12 18:12, Yogesh patel wrote:
>>
>>> Hi
>>>
>>> I have index 100000 documents in Lucene. I have one query that gets all
>>> documents and it takes more time..
>>> So i need to implement paging in lucene query so i can search result fast
>>> page wise.
>>>
>>> Is it possible to do paging or smart rendering with Lucene.
>>>
>>> Awaiting for reply.
>>>
>>>
>

Lucene java-user RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.