apache / apache/lucene

WeightedSpanTermExtractor unnexessarily enforces rewrite for some SpanQueiries [LUCENE-8637]

Open
#9,683 3 comments 0 reactions 0 assignees View on GitHub
affects-version:7.3.1 affects-version:7.4 affects-version:7.5 affects-version:7.6 legacy-jira-label:patch legacy-jira-priority:Minor module:highlighter type:bug
Dominant language
Java
Stars
3.6k
Forks
1.4k
Avg merge
2d 11h
Merged PRs (30d)
88

Description

Method mustRewriteQuery(SpanQuery) returns true for SpanPositionCheckQuery, SpanContainingQuery, SpanWithinQuery, and SpanBoostQuery, however, these queries do not require rewriting. One effect of this is e.g. that UnifiedHighlighter does not work with OffsetSource Postings and switches to Analysis which of course has consequences for performance.

I attach a patch for lucene version 7.6.0. I have not checked whether it breaks existing unit tests.

---
Migrated from [LUCENE-8637](https://issues.apache.org/jira/browse/LUCENE-8637) by Christoph Goller, updated Mar 21 2022
Attachments: [WeightedSpanTermExtractor.java](https://apache.github.io/lucene-jira-archive/attachments/LUCENE-8637/WeightedSpanTermExtractor.java)
Linked issues:
- #11513

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.