Skip to content

max_analyzed_offset can not Limited OffsetSource.POSTINGS #86109

@luyuncheng

Description

@luyuncheng

Description

In #67325 add max_analyzed_offset allows users to limit the highlighting of text fields.
but when using "index_options": "offsets" in mappings, this max_analyzed_offset offset limit can not be limited, because it would use OffsetSource.ANALYSIS and PostingsOffsetStrategy to highlight field.

Some tests can simply explain: link

When a string="Testing Fun Testing Fun" need to be highlight

Using UnifiedHighlighter.OffsetSource.ANALYSIS with queryMaxAnalyzedOffset=10 would response:

"Testing <b>Fun</b> Testing Fun"

because in #67325 add LimitTokenOffsetAnalyzer

BUT USING UnifiedHighlighter.OffsetSource.POSTINGS which index_options=offsets with queryMaxAnalyzedOffset=10 would response:

"Testing <b>Fun</b> Testing <b>Fun</b>"

because offset can not be limited by LimitTokenOffsetAnalyzer

Proposal

may be can add a new LimitedOffsetsEnum to limit this

Link PR: #86110

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions