apache / apache/lucene

Highlighter does not highlight when using large exact phrase query [LUCENE-4502]

Open
#5,568 2 comments 0 reactions 0 assignees View on GitHub
affects-version:3.6 affects-version:4.0 legacy-jira-priority:Major module:highlighter type:bug
Dominant language
Java
Stars
3.6k
Forks
1.4k
Avg merge
2d 11h
Merged PRs (30d)
88

Description

For example I have the text
```

The text which appears before and after a highlighted term when using the simple formatter This parameter accepts per-field overrides.
```

I want to highlight this text with the query

```java

String query = "\"which appears before and after a highlighted term when using the simple formatter\""
```

Using the EnglishAnalyzer it does not highlight.
Using the WhitespaceAnalyzer it's highlight.

If the query is smaller the hightlight is correct.

I have try to track the issue, but it go to deeply into Lucene core at NearSpansUnordered

---
Migrated from [LUCENE-4502](https://issues.apache.org/jira/browse/LUCENE-4502) by Nicolas Labrot (@nithril), updated Aug 09 2013
Attachments: [LUCENE-4502.zip](https://apache.github.io/lucene-jira-archive/attachments/LUCENE-4502/LUCENE-4502.zip)

Contributor guide

Open the contributing guide

Research direction

Reproduce the exact phrase highlighting case with EnglishAnalyzer and compare it with WhitespaceAnalyzer, using the example text and query in the issue. Start by tracing the phrase through NearSpansUnordered and inspect the attached LUCENE-4502.zip for additional reproduction details. Done means the large exact phrase highlights correctly without regressing smaller phrase queries.

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.