Description
XPath queries that contain "or" with can in some cases return the same node twice. Those queries are converted to "union", as follows, where the same problem exists:
select [jcr:path], [jcr:score], * from ... where contains(*, 'square') union select [jcr:path], [jcr:score], * from ... where [x] = '1'
Currently, the results of both subqueries are combined with "Iterators.concat(left.getRows(), right.getRows())" (Iterators is from Google Guava). That means results of the first part of the union is executed, then the result of the second query. This result is wrapped / filtered using "FilterIterators.newCombinedFilter(it, distinct, limit, offset, orderBy, settings)", which is Oak code. "distinct" is true for "union" and false for "union all".
Now, "distinct" operates on the result row object, which contains the path, the score, and all property values. In previous versions, the "jcr:score" was always a fixed value, but in the latest Oak version "jcr:score" is the value returned from the index, which means the two rows are not equal:
path: /test/a, score: 0.5 (from the first subquery; Lucene index) path: /test/a, score: 0.0 (from the second subquery; property index)
Attachments
Issue Links
- is related to
-
OAK-7605 Giving multiple result when executing query (for a constraints with OR condition) for Facetextraction
- Closed