apache / apache/lucene

ToParentBlockJoinQuery deothogonalization [LUCENE-5816]

Open
#6,878 1 comment 0 reactions 0 assignees View on GitHub
affects-version:4.9 legacy-jira-priority:Major module:join type:enhancement
Dominant language
Java
Stars
3.6k
Forks
1.4k
Avg merge
2d 11h
Merged PRs (30d)
88

Description

For now ToParentBlockJoinQuery accepts only child
documents. Before (#6032) passing parent document to TPBJQ lead to
undefined behavior and garbage in results, unfortunately it also affects
TPBJQ.advance(). After pointed patch IllegalStateException is
thrown when this occurs.

So we must always take parent-child relations into account while writing
queries. At most of time it is necessary when writing a query, but sometimes,
filters can be independent of data model (for example, ACL filters:
+TPBJQ +allowed:user).

TPBJQ shall returns parent doc if parent doc is passed to TPBJQ.advance()
or returned from childScorer.advance(). This change doesn't break anything:
results will be absolutely the same for parent-child orthogonal queries.

In few words: Document matching parent filter should be parent of itself.

---
Migrated from [LUCENE-5816](https://issues.apache.org/jira/browse/LUCENE-5816) by Nikolay Khitrin (@khitrin), 1 vote
Attachments: [LUCENE-5816.patch](https://apache.github.io/lucene-jira-archive/attachments/LUCENE-5816/LUCENE-5816.patch) (versions: 2)

Contributor guide

Open the contributing guide

Research direction

Start at ToParentBlockJoinQuery, focusing on advance() and childScorer.advance(), and review the attached LUCENE-5816.patch. Done means parent documents are handled as their own parent without changing results for parent-child-orthogonal queries. No test file is named in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
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.