lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject Re: New highlighter package available
Date Thu, 02 Oct 2003 07:29:26 GMT
>>>From what I remember when doing similar patches to Lucene core, alternative
>>way (not adding any new support) requires one to dig deep into implementation
>>details of Lucene term and query objects, breaking encapsulation

That may well used to be the case but not since query.rewrite() was introduced.
All of the existing "complex" query types (range/prefix/fuzzy etc) 
are redefined as more primitive term queries in their implementation of query.rewrite(reader).

This is what enables the highlighter to work with these queries without having to change Lucene

Incidentally, having thought about the overhead of query.rewrite(reader) I have chosen to

remove that code from the highlighter package. It is now the responsibility of the caller
1) Call rewrite on the query to obtain a primitive version
2) Do a search using the primitive query
3) Call the highlighter with the primitive query.
...if they want "complex" query types to be highlighted

This way the term expansion hit only occurs once.
Slightly more complex to use but more efficent.

Hope this helps clarify things

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message