lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From markharw...@yahoo.co.uk
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
internals.

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
to:
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
Mark

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


Mime
View raw message