apache / apache/lucenenet

The order of disjuncts in DisjunctionMaxQuery affects equals()

Open
#779 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
2.4k
Forks
658
Avg merge
3d 5h
Merged PRs (30d)
9

Description

See [Lucene-9940](https://issues.apache.org/jira/browse/LUCENE-9940). I find it valid for current Lucene.Net.

DisjunctionMaxQuery stores its disjuncts in a java array, and its equals() implementation uses Arrays.equal() when checking equality. This means that two queries with the same disjuncts but added in a different order will compare as different, even though their results will be identical. We should replace the array with a Set.

Fix it may break current behavior, but in case someone need it, I will create a PR.

Contributor guide

Open the contributing guide

Research direction

Start with DisjunctionMaxQuery.equals() and the representation of its disjuncts. Verify how equality currently treats insertion order, then check related query-equality coverage and compatibility concerns; done means queries containing the same disjuncts compare consistently regardless of insertion order.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
search
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.