You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by "reugn (via GitHub)" <gi...@apache.org> on 2026/10/21 08:00:56 UTC

[PR] Convert terms to UTF-16 once in UnifiedHighlighter [lucene]

reugn opened a new pull request, #16881:
URL: https://github.com/apache/lucene/pull/16881

   `FieldOffsetStrategy.createOffsetsEnumsForAutomata` converted each term from UTF-8 to UTF-16 once per automaton, so a query with N multi-term clauses (fuzzy, wildcard, prefix, regexp) converted every term N times. This change moves the conversion out of the inner loop, so each term is converted once. Behavior is unchanged.
   
   The benefit shows up when weight matches is disabled (it's on by default) and the field uses term vectors, since the loop then walks all of the document's terms. With `ANALYSIS` offsets the loop only sees terms that already passed the matchers, so there is little to save.
   
   In a JMH benchmark that highlights 10 docs of 1,000 words with term vectors, the highlight call was about 16% faster with 16 fuzzy clauses (edit distance 1) and unchanged with one clause.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org