Skip to content

Commit 06e34bd

Browse files
Copilotanidotnet
andcommitted
Fix OR filter duplicate results with multiple indexes
Co-authored-by: anidotnet <696662+anidotnet@users.noreply.github.com>
1 parent 64383e1 commit 06e34bd

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

nitrite/src/main/java/org/dizitart/no2/collection/operation/ReadOperations.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,9 @@ private RecordStream<Pair<NitriteId, Document>> findSuitableStream(FindPlan find
127127
// concat all suitable stream of all sub plans
128128
rawStream = new ConcatStream(subStreams);
129129

130-
if (findPlan.isDistinct()) {
131-
// return only distinct items
132-
rawStream = new DistinctStream(rawStream);
133-
}
130+
// Always apply distinct stream for OR filters to avoid duplicates
131+
// when the same document matches multiple sub-plans (different indexes)
132+
rawStream = new DistinctStream(rawStream);
134133
} else {
135134
// and or single filter
136135
if (findPlan.getByIdFilter() != null) {

0 commit comments

Comments
 (0)