List Info

Thread: paging search results




paging search results
user name
2007-01-22 15:15:15
Hi,
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.

- 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-devosafoundation.org
http://lists.osafoundation.org/mailman/listinfo/pylu
cene-dev

Re: paging search results
user name
2007-01-22 15:33:02
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-userlucene.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-devosafoundation.org
> http://lists.osafoundation.org/mailman/listinfo/pylu
cene-dev
>
_______________________________________________
pylucene-dev mailing list
pylucene-devosafoundation.org
http://lists.osafoundation.org/mailman/listinfo/pylu
cene-dev

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )