Hi I've come across the PageHitCollector class from the: http://mail-archives.apache.org/mod_mbox/lucene-java-user/200707.mbox/%3c070320071521.6119.468a6964000b3e75000017e72205884484070a9c0701030...@comcast.net%3e
I'm looking at using this in the multisearcher class, and do: search(query,filter,pageHitCollector) I intend to use comparators to do the sorting and use collections.sort(). I would be grateful for any feedback on whether this is a good approach. Cheers Amin On Mon, Mar 16, 2009 at 8:03 AM, Amin Mohammed-Coleman <ami...@gmail.com>wrote: > Hi Erick > > I've seen the following: > > TopDocCollector collector = new TopDocCollector(hitsPerPage) and then pass > the collector to the seacher. But I'm not sure how I increment the > hitsPerPage. Also how do I get the total results returned? > > In relation to sorting I could basically use Collections.sort(..) or > something similar. My search returns a collection of summary objects which > I could sort at that stage rather than passing it to the search code. This > would mean I could use a collector to do this. > > Cheers > Amin > > > > > On Mon, Mar 16, 2009 at 1:42 AM, Erick Erickson > <erickerick...@gmail.com>wrote: > >> Basically, the FileSortedHitQueue is just a sorting mechanism you >> implement yourself. But I can't help but think that there's an easier >> way, although I'll have to admit I haven't used MultiSearcher enough >> to offer much guidance..... That'll teach me to send something off >> on Sunday that I don't really understand well enough.... >> >> Sorry 'bout that >> Erick >> >> On Sun, Mar 15, 2009 at 9:15 AM, Amin Mohammed-Coleman <ami...@gmail.com >> >wrote: >> >> > HI Erick >> > Thanks for your reply, glad to see I'm not the only person >> > working/developing on a Sunday! I'm not sure how the >> FieldSortedHitQueue >> > works and how it can be applied to the search method exposed by >> > MultiSearcher. Would it be possible to clarify abit more or even point >> to >> > some reference documentation? >> > >> > Cheers >> > Amin >> > >> > On Sun, Mar 15, 2009 at 1:08 PM, Erick Erickson < >> erickerick...@gmail.com >> > >wrote: >> > >> > > You could do something with FieldSortedHitQueue as a post-search >> > > sort, but I wonder if this would work for you... >> > > >> > > public TopFieldDocs >> > > < >> > > >> > >> http://lucene.apache.org/java/2_4_1/api/org/apache/lucene/search/TopFieldDocs.html >> > > > >> > > *search*(Query < >> > > >> > >> http://lucene.apache.org/java/2_4_1/api/org/apache/lucene/search/Query.html >> > > > >> > > query, >> > > Filter >> > > < >> > > >> > >> http://lucene.apache.org/java/2_4_1/api/org/apache/lucene/search/Filter.html >> > > > >> > > filter, >> > > int n, >> > > Sort >> > > < >> > > >> > >> http://lucene.apache.org/java/2_4_1/api/org/apache/lucene/search/Sort.html >> > > > >> > > sort) >> > > throws IOException >> > > <http://java.sun.com/j2se/1.4/docs/api/java/io/IOException.html> >> > > >> > > >> > > Best >> > > Erick >> > > >> > > >> > > On Sun, Mar 15, 2009 at 2:12 AM, Amin Mohammed-Coleman < >> ami...@gmail.com >> > > >wrote: >> > > >> > > > Hi >> > > > >> > > > I'm looking at trying to implement pagination for my search project. >> > I've >> > > > been google-ing for a solution. So far no luck. I've seen >> > implementations >> > > of >> > > > HitCollector which looks promising, however my search method has to >> > > > completely change. >> > > > >> > > > For example I'm currently using the following: >> > > > >> > > > search ( query, filter,int, sort) >> > > > >> > > > If I use a HitCollector there isn't a search to apply >> > > > query,hitcollector,sort and filter, unless I'm supposed to apply >> sort >> > and >> > > > filter in the hit collector. >> > > > >> > > > I would be grateul if anyone could advise me what approach to take. >> > > > >> > > > One a side note I just want to thank you all for helping me with >> many >> > of >> > > my >> > > > issues. I'm hoping this is my last question! Thanks for your >> patience! >> > > > >> > > > >> > > > Cheers >> > > > >> > > > Amin >> > > > >> > > > >> > > > >> --------------------------------------------------------------------- >> > > > To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org >> > > > For additional commands, e-mail: java-user-h...@lucene.apache.org >> > > > >> > > > >> > > >> > >> > >