CustomComparatorSource is a class which extends FieldComparatorSource I
just want to custom the sort and add some business logic into the
comparator
actually my desirable situation is
firt sort by CustomComparatorSource
and then sort by the score
thanks man
2012/11/30 Ian Lea
> Using a TopFie
Using a TopFieldCollector works fine for me in a little test program.
My program sorts on a simple String field rather than your
CustomComparatorSource, whatever that is.
SortField sortField[] = {
new SortField("cat", SortField.STRING),
SortField.FIELD_SCORE
};
Sort
I revise the code to
SortField sortField[] = {new SortField("id", new
CustomComparatorSource(bitSet)),SortField.FIELD_SCORE};
Sort sort = new Sort(sortField);
TopFieldCollector topFieldCollector =
TopFieldCollector.create(sort, 1000, true, true, true, true);
index
What are you getting for the scores? If it's NaN I think you'll need
to use a TopFieldCollector. See for example
http://www.gossamer-threads.com/lists/lucene/java-user/86309
--
Ian.
On Tue, Nov 27, 2012 at 3:51 AM, Andy Yu wrote:
> Hi All,
>
>
> Now I want to sort by a field and the relevan