Re: custom sorting / help overriding FieldComparator

2010-09-17 Thread Chris Hostetter

Brad:

1) if you haven't already figured this out, i would suggest emailin the 
java-user mailing list.  It's got a bigger collection of users who are 
familiar with the internals of the Lucnee-Java API (that's the level it 
seems like you are having difficulty at)

2) Maybe you mentioned your sorting algorithm in a previous thread, but 
i'm not remembering it -- it's possibly this is an XY problem, if you 
describe the algorithm you need (or show us the code for your Comparable 
impl) we might be able to suggest an efficient way to do this with out any 
custom code in Solr...
http://people.apache.org/~hossman/#xyproblem


: 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 codeComparble/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
: 
: 
: 
: 

-Hoss

--
http://lucenerevolution.org/  ...  October 7-8, Boston
http://bit.ly/stump-hoss  ...  Stump The Chump!



custom sorting / help overriding FieldComparator

2010-09-09 Thread Brad Dewar
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 codeComparble/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