Hi, What is the recommended way to use custom Query implementations with Lucene (3.3.0) Highlighter framework?
In short, what worries me a bit is the fact that WeightedSpanTermExtractor#extract(Query, Map<String, WeightedSpanTerm>) accepts a general Query parameter but inside it does a lot of tests against particular implementations ( ... if query instanceof BooleanQuery then ... ) with no default option to fall back to. What if I have my own (or third-party) implementation of Query? Or even with some Lucene built-in Query types (like BoostingQuery) there is a chance that the extract() method will silently fall through and does not let me know that this particular Query implementation is unknown to it. AFAIK typical use case of Highlighter API can go like this: Query query = _some_query_instance_; QueryScorer scorer = new QueryScorer(query, "field"); // query? or query.rewrite() or ... ? ... etc ... Highlighter highlighter = new Highlighter(scorer); ... etc ... Saying this, I am looking for an advice about how to deal with this Highlighter API correctly so that I do not have to check the source code of WeightedSpanTermExtractor in advance to learn whether I need to call rewrite (or other custom method) on the query object or not. Regards, Lukas