Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2009
    Rep Power

    Default Lucene results paging

    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 = (, 100000)
    //For example

    and after that I get the needed results in such way:

    //for example startPage = 20, endPage = 40
    for(int j=startPage; j<stopPage; j++){

    doc[j-startPage] = 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.

  2. #2
    andrewlowe is offline Member
    Join Date
    Jan 2010
    Rep Power

    Default Lucene Results Paging

    You're probably better off using Solr, this kind of capability comes with simple query parameters, see
    Common Query Parameters - Search by Lucid Imagination


Similar Threads

  1. Struts 2 paging problem using display tag...?
    By prabhurangan in forum Web Frameworks
    Replies: 1
    Last Post: 01-15-2014, 10:00 AM
  2. Paging in swing when using MS-SQL
    By Java.child in forum AWT / Swing
    Replies: 0
    Last Post: 11-17-2008, 10:04 PM
  3. Paging Problem
    By jazz2k8 in forum Advanced Java
    Replies: 3
    Last Post: 11-05-2008, 03:29 PM
  4. Java Paging Problem
    By 82rathi.angara in forum New To Java
    Replies: 2
    Last Post: 09-29-2008, 04:17 PM
  5. [SOLVED] Display tag paging help..............?
    By prabhurangan in forum Web Frameworks
    Replies: 12
    Last Post: 06-24-2008, 01:30 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts