apache / apache/lucene

Match spotter for all query types [LUCENE-1999]

Open
#3,074 9 comments 0 reactions 0 assignees View on GitHub
affects-version:2.9 legacy-jira-priority:Major module:core/search type:enhancement
Dominant language
Java
Stars
3.6k
Forks
1.4k
Avg merge
2d 11h
Merged PRs (30d)
88

Description

Related to #3004 and the current inability to highlight NumericRangeQuery, spatial, cached term filters and other exotica.

This patch provides the ability to wrap **any** Query objects and record match info as flags encoded in the overall document score.
Using this approach it would be possible to understand (and therefore highlight) which fields matched clauses in a query.

The match encoding approach loses some precision in scores as noted here: http://tinyurl.com/ykt8nx7

Avoiding these precision issues would require a change to Lucene core to record docId, score AND a matchFlag byte in ScoreDoc objects and collector APIs.
This may be something we should consider.

---
Migrated from [LUCENE-1999](https://issues.apache.org/jira/browse/LUCENE-1999) by Mark Harwood (@markharwood), updated Apr 14 2012
Attachments: [matchflagger.patch](https://apache.github.io/lucene-jira-archive/attachments/LUCENE-1999/matchflagger.patch)

Contributor guide

Open the contributing guide

Research direction

Start with the attached matchflagger.patch and the related #3004 and LUCENE-1999 discussions. Review how the proposed query wrapping records match flags in document scores, then clarify the required Lucene core changes and score-precision trade-offs before defining completion criteria.

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
Needs clarification
Newbie friendliness
22/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.