Skip to content

Commit

Permalink
LUCENE-10523: factor out UnifiedHighlighter.newFieldHighlighter() met…
Browse files Browse the repository at this point in the history
…hod (#821)
  • Loading branch information
cpoerschke authored Jul 13, 2022
1 parent 7c35311 commit 56462b5
Showing 1 changed file with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1077,7 +1077,7 @@ protected FieldHighlighter getFieldHighlighter(
String field, Query query, Set<Term> allTerms, int maxPassages) {
UHComponents components = getHighlightComponents(field, query, allTerms);
OffsetSource offsetSource = getOptimizedOffsetSource(components);
return new FieldHighlighter(
return newFieldHighlighter(
field,
getOffsetStrategy(offsetSource, components),
new SplittingBreakIterator(getBreakIterator(field), UnifiedHighlighter.MULTIVAL_SEP_CHAR),
Expand All @@ -1087,6 +1087,24 @@ protected FieldHighlighter getFieldHighlighter(
getFormatter(field));
}

protected FieldHighlighter newFieldHighlighter(
String field,
FieldOffsetStrategy fieldOffsetStrategy,
BreakIterator breakIterator,
PassageScorer passageScorer,
int maxPassages,
int maxNoHighlightPassages,
PassageFormatter passageFormatter) {
return new FieldHighlighter(
field,
fieldOffsetStrategy,
breakIterator,
passageScorer,
maxPassages,
maxNoHighlightPassages,
passageFormatter);
}

protected UHComponents getHighlightComponents(String field, Query query, Set<Term> allTerms) {
Predicate<String> fieldMatcher = getFieldMatcher(field);
Set<HighlightFlag> highlightFlags = getFlags(field);
Expand Down

0 comments on commit 56462b5

Please sign in to comment.