mirror of https://github.com/apache/lucene.git
LUCENE-10523: factor out UnifiedHighlighter.newFieldHighlighter() method (#821)
This commit is contained in:
parent
7c35311f29
commit
56462b5f96
|
@ -1077,7 +1077,7 @@ public class UnifiedHighlighter {
|
|||
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),
|
||||
|
@ -1087,6 +1087,24 @@ public class UnifiedHighlighter {
|
|||
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);
|
||||
|
|
Loading…
Reference in New Issue