[pylucene-dev] paging search results

Andi Vajda vajda at osafoundation.org
Mon Jan 22 13:33:02 PST 2007


On Mon, 22 Jan 2007, Kenny Ma wrote:

> I've read that paging is most efficient when applied to the hits object but 
> I'm not sure what's the best way to implement this.  This is what i have:
>
>      searcher = IndexSearcher(indexDir)
>       hits = searcher.search(query)
>             max = hits.length()
>       start = 0
>       end = 50
>       results = []
>             for i in range(start, end):
>           if i > max:
>               break
>                     results.append(hits[i])
>             return results
>
> Is there a better way of doing this? I'm new to PyLucene and any pointers 
> would be greatly appreciated.

A great source of answers to general Lucene API usage questions is:
     java-user at lucene.apache.org
Even though this pertains to the Java APIs, the PyLucene APIs are the same, 
except for some additions that make the PyLucene APIs more pythonic. All 
answers you can get there to general Lucene API questions are equally 
applicable to PyLucene.

Andi..

>
> - Kenny
>
> [This electronic message may contain information that may fall under the 
> classification of Company Confidential or Company Proprietary Information: 
> This electronic message may contain confidential/proprietary information and 
> is for the personal and exclusive use of the recipient(s) to whom it is 
> addressed.  If you have received this transmission and are not the intended 
> recipient(s) or his/her agent, please be advised that any disclosure, use, 
> review, copying, selling, dissemination, publication or distribution of this 
> transmission is unauthorized and prohibited. If you have received this 
> transmission in error, please notify this office and destroy this message. 
> FOLDERA(TM), Group Information Manager(TM) and GIM(TM) are trademarks of 
> Foldera, Inc., Huntington Beach, California.]
>
> _______________________________________________
> pylucene-dev mailing list
> pylucene-dev at osafoundation.org
> http://lists.osafoundation.org/mailman/listinfo/pylucene-dev
>


More information about the pylucene-dev mailing list