David Smiley created LUCENE-8160:
------------------------------------
Summary: Highlighting QueryVisitor & SpanQueryConverter
Key: LUCENE-8160
URL: https://issues.apache.org/jira/browse/LUCENE-8160
Project: Lucene - Core
Issue Type: Improvement
Components: modules/highlighter
Reporter: David Smiley
Assignee: David Smiley
Frustratingly we still don't have a Query visitor API in Lucene ( LUCENE-3041 )
so I took a basic stab at it within the confines of the UnifiedHighlighter.
This patch is more of a simple pragmatic solution for the UH than it is for the
wholistic goals of LUCENE-3041 (that would likely change Query itself). Today
the UH has one massive if-else Query branch – MultiTermHighlighting, plus it
re-uses WeightedSpanTermExtractor (WSTE) from the original Highlighter in a
rather hacky way. In this patch I introduce QueryVisitor.java to the UH that
has the massive instanceof branches in it with many places to subclass. I
modified MultiTermHighlighting to use it and I modified PhraseHelper as well to
wean itself off of WSTE. Interestingly PhraseHelper needed to instantiate this
a second time since it needed to separately look to see if the SpanQuery
contained a SpanMultiTermQueryWrapper. QueryVisitor and some usage sites
contain numerous TODOs to elicit some conversation in a code review about the
approach.
To fully wean the UH off of WSTE, I also added a SpanQueryConverter for
converting PhraseQuery and MultiPhraseQuery. Again I also conservatively added
it to the highlighter module even though it's of a general nature.
Although the patch "works", it needs cleanup and feedback.
CC [~romseygeek] [~jimczi]
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]