apache / apache/lucene

join query scanning "toField" docValue [LUCENE-6332]

Open
#7,393 4 comments 0 reactions 0 assignees View on GitHub
affects-version:5.0 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

I want to contribute the subj which should do something like ..`WHERE EXISTS (SELECT 1 FROM fromSearcher.search(fromQuery) WHERE fromField=toField)`. It turns out, that it can be returned by the current method `createJoinQuery(...ScoreMode.None)`
- at first, it should run `fromQuery` first, collect `fromField` into `BytesRefHash` by `TermsCollector`, like it's done now
- then it should return query with _TwoPhase_ Scorer
- which obtains `toField` docValue on `matches()` and check term for existence in `BytesRefHash`

Do you think it's ever useful? if you do, I can bake a patch.
Anyway, suggest the better API eg separate method, or enum and actual name!

---
Migrated from [LUCENE-6332](https://issues.apache.org/jira/browse/LUCENE-6332) by Mikhail Khludnev (@mkhludnev), updated Mar 12 2015
Attachments: [LUCENE-6332.patch](https://apache.github.io/lucene-jira-archive/attachments/LUCENE-6332/LUCENE-6332.patch)
Linked issues:
- [SOLR-6234](https://issues.apache.org/jira/browse/SOLR-6234)

Contributor guide

Open the contributing guide

Research direction

Start at createJoinQuery(..., ScoreMode.None) and trace the existing TermsCollector path that collects fromField into BytesRefHash. Then evaluate the proposed TwoPhase Scorer, including toField doc values and term-existence checks; done means the join query matches documents whose toField exists in the collected fromField terms, with an agreed API.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
search
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.