Peter:
About a custom ScoreComparator. The problem I couldn't get past was that I
needed to know the max score of all the docs in order to divide the raw
scores into quintiles since I was dealing with raw scores. I didn't see how
to make that work with ScoreComparator, but I confess that I
Erick,
I think you're right because you'd wouldn't know the max score before the
comparisons. I'm just thinking about a rounding algorithm that involves
comparing the raw scores to the theoretical maximum score, which I think
could be computed from the Similarity class and knowing the max boost
can't you pick any arbitrary marker field name (that's not a real field
name) and use that?
Yes, I could. I guess you're saying that the field name doesn't matter,
except that it's used for caching the comparator, right?
... he wants the bucketing to happen as part of hte scoring so that the
Empirically, when I insert the elements in the FieldSortedHitQueue
they get sorted according to the Sort object. The original query
that gives me a TopDocs applied
no secondary sorting, only relevancy. Since I normalized
all the scores into one of only 5 discrete values, and secondary
sorting was
Erich,
Yes, this seems to be the simplest way to implement score 'bucketization',
but wouldn't it be more efficient to do this with a custom ScoreComparator?
That way, you'd do the bucketizing and sorting in one 'step' (compare()).
Maybe the savings isn't measurable, though. A comparator might
It may well be, but as I said this is efficient enough for my needs
so I didn't pursue it. One of my pet peeves is spending time making
things more efficient when there's no need, and my index isn't
going to grow enough larger to worry about that now G...
Erick
On 2/28/07, Peter Keegan [EMAIL
Suppose one wanted to use this custom rounding score comparator on all
fields and all queries. How would you get it plugged in most efficiently,
given that SortField requires a non-null field name?
Peter
On 2/1/06, Chris Hostetter [EMAIL PROTECTED] wrote:
: I've not used the sorting code
: Suppose one wanted to use this custom rounding score comparator on all
: fields and all queries. How would you get it plugged in most efficiently,
: given that SortField requires a non-null field name?
i'm not sure i understand the first part of question .. this custom
SortComparatorSource
I'm building up the Sort object for the search with 2 SortFields - first is
for the custom rounded scoring, second is for date. This Sort object is used
to construct a FieldSortedHitQueue which is used with a custom HitCollector.
And yes, this comparator ignores the field name.
hmmm, actually i
This may be off base, but I've recently been in something similar.
The first part was just to iterate through the TopDocs that's available to
my and normalize the scores right in the ScoreDocs. Like this...
for (ScoreDoc scd : this.topDocs.scoreDocs) {
scd.score =
: The constructor doesn't complain, but FieldSortedHitQueue expects a field
: name when it tries to locate the comparator from the cache:
can't you pick any arbitrary marker field name (that's not a real field
name) and use that?
-Hoss
: The first part was just to iterate through the TopDocs that's available to
: my and normalize the scores right in the ScoreDocs. Like this...
Won't that be done after the Lucene does the hitcollecting/sorting? ... he
wants the bucketing to happen as part of hte scoring so that the
secondary
Subject
RE: Sorting by Score(Document link:
Daniel clark
My primary sort is by relevance score and my secondary sort is by date.
The Hits.getScore() method returns the score by 7 digits to the right of
the decimal point. Therefore, If I round to only 2 decimal points in the
display, the underlying 7 point score will be different in the sort.
Example:
:24 AM
To: java-user@lucene.apache.org
Subject: Sorting by Score
My primary sort is by relevance score and my secondary sort is by date.
The Hits.getScore() method returns the score by 7 digits to the right of the
decimal point. Therefore, If I round to only 2 decimal points in the display
: I've not used the sorting code yet, but it looks like you have to
: provide some custom ScoreDocComparator by adding a SortField using the
: SortField(String field, SortComparatorSource comparator) constructor.
: I'm just not certain what you should specify for the field value since
: you
Hostetter
Sent: Wednesday, February 01, 2006 4:06 PM
To: java-user@lucene.apache.org
Subject: RE: Sorting by Score
: I've not used the sorting code yet, but it looks like you have to
: provide some custom ScoreDocComparator by adding a SortField using the
: SortField(String field
: from your previous post about memory...Every time you sort on a field,
: a FieldCache array is constructed for that field.
:
: would that happen in this case for the field this comparator is not using?
Ooohhh ... good question. As long as you write your own implimentation of
18 matches
Mail list logo