It's a bit hard for me to parse what you are trying to do, but it
looks like you are making assumptions about how Lucene works
internally that are not correct.

Do I understand correctly that your scoring mechanism has dependencies
on other documents, ie. the score of a document could depend on the
score of other documents? This is something that Lucene doesn't
support.

On Thu, Mar 10, 2022 at 12:23 PM Claude Lepere <claudelep...@gmail.com> wrote:
>
> Hi.
> The problem is that although sorting by score a match with a lower score is
> ranked before a match with a greater score.
> The origin of the problem lies in a subclass of CustomScoreQuery which
> calculates an "only once" score for each document: on the first pass the
> document gets its score and, if the document contains several times the
> same field, on the subsequent passes it gets 0.
> I wonder if it is possible for Lucene to give a score that depends on a
> previous pass in the CustomScoreProvider customScore routine for the same
> document.
> I ran 2 searches with IndexSearcher: the first one returns a TopDocs which
> is sorted by default by relevance, and the second search - with the Sort
> array = [SortField.FIELD_SCORE, a date SortField] argument - returns a
> TopFieldDocs.
> The TopDocs results are sorted by the score with the first pass value of
> the only once method while the TopFieldDocs results are sorted by the score
> with the value (= 0) of the next pass, hence the ranking errors.
> I did not find why does the TopFieldDocs search not use to sort the score
> of the hit, as the TopDocs search?
> I did not find how to tell the TopFieldDocs search to use the hit score to
> sort.
>
> Claude Lepère



-- 
Adrien

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
For additional commands, e-mail: java-user-h...@lucene.apache.org

Reply via email to