You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by Tim Jones <TJ...@hoovers.com> on 2004/01/12 20:21:56 UTC

Re: arbitrary sorting

Erik et al,

In the attached .zip are the files implementing the functionality I
described.  I ended up just putting the classes in the
org.apache.lucene.search package - that makes the constructor problem I
mentioned not an issue.  Therefore there's not a bug to post the code
against, so I'm just attaching it here.  Let me know if there is something
else I should do.

For reference, it was the org.apache.lucene.search.TopDocs which was the
problem - I needed to call it from the SortedIndexSearcher I created, but it
can't be called from outside the org.apache.lucene.search package.

The class to look at is org.apache.lucene.search.SortedIndexSearcher.  It
contains some basic informatin about how to use it.

I call this v0.1 because there are some constraints on the fields used to
sort - they must contain a single term which is an integer value.  If what
I've done looks like a good direction to take in the API, though, it would
be possible to make the code able to handle arbitrary term values, with a
little worse performance.

Tim  


> -----Original Message-----
> From: Erik Hatcher [mailto:erik@ehatchersolutions.com]
> Sent: Monday, January 05, 2004 12:56 PM
> To: Lucene List
> Subject: Re: making a contribution
> 
> 
> This is great news!
> 
> Please attach your new files to a new Bugzilla issue for Lucene (see 
> Jakarta website for details) and either submit a 'cvs diff -u' patch 
> file along with the issue or just describe what constructor needed to 
> be opened up to public in the issue text.
> 
> Where your contribution would ultimately reside is unclear.  At the 
> very least, it can live in the sandbox if you are ok with making it 
> Apache Software License.
> 
> 	Erik
> 
> On Jan 5, 2004, at 1:07 PM, Tim Jones wrote:
> 
> >
> > I've come up with an implementation for doing arbitrary sorting in 
> > lucene -
> > it is an implementation of PriorityQueue that can sort by 
> an arbitrary 
> > field
> > as well as the computed relevancy.  It is quite speedy and 
> should be 
> > faster
> > than doing a sort in the appplication after getting the 
> results back 
> > from
> > lucene.
> >
> > I thought I'd make this available to the lucene community - what is 
> > the best
> > way to do this?  Should it go in "Contributions", or "Sandbox"?
> >
> > The meat of it for version 0.1 is four classes which 
> subclass existing
> > lucene classes, and one modification to an existing lucene class to 
> > make the
> > constructor public so it can be subclassed.  So really what 
> it means is
> > adding additional API by "jar -uf lucene.jar ..."
> >
> > Tim