Hi

I'm trying to get my (overly complex and strange) product IDs sorting properly 
in Solr.

Approaches I've tried so far, that I've given up on for various reasons:
--Normalizing/padding the IDs so they naturally sort 
alphabetically/alphanumerically.
--Splitting the ID into multiple Solr fields and sending a longer, multi-field 
"sort" argument in the GET request.
--(both of those approaches do work "most of the time", but aren't quite 
perfect)

However, in another project, I already have a <code>Comparble</code> class 
defined in Java that represents a ProductID and does sort them correctly every 
time.  It's not yet in lucene/solr, though.  So I'm trying to make a FieldType 
plugin for Solr that uses the existing ProductID class/datatype.

I need some help extending the lucene FieldComparator class.  I don't know much 
about the rest of the solr / lucene codebase, so I'm fumbling around a bit, 
especially with the required setNextReader() method.  setNextReader() looks 
like it checks the FieldCache to see if this value is there already, otherwise 
grabs a bunch of documents from the index.  I think I should call some form of 
FieldCache.getCustom() for this, but FieldCache.getCustom() itself accepts a 
comparator as an argument, and is marked as "@deprecated Please implement 
FieldComparatorSource directly, instead" ... but isn't that what I'm doing?

So, I'm just a bit confused.  Any help?  Specifically, any help implementing a 
setNextReader() method in a customComparator?

(solr 1.4.1 / lucene 2.9.3)

Thanks,
Brad



Reply via email to