Sorry its taken me so long to look at these. Clemens Marschner wrote:
A few issues I spotted:Enclosed you find the diffs I promised for enabling query rewriting.This also enables tools such as the HTML term highlighter (http://www.iq-computing.de/lucene/highlight.jsp). There's one difference to the white paper there: I didn't want to make arrays public, so getClauses() in BooleanClause only returns an iterator. The same with getTerms() in PhraseQuery. I have included my version of LuceneTools.java as presented on the website I mentioned.
You don't need to clone Terms. In the public API they're read-only, like Strings. Term should also not expose setField() or setText() methods. (Also, you ignore the result of String.intern() in these methods, but that doesn't matter, since you shouldn't implement them anyway...)
You should not expose PhraseQuery.setField() either. This field is set implicitly when you add terms to a phrase query and should never be set otherwise. Similarly with other classes, where you've added setter methods.
In general, I would be more comfortable with these changes if they only added get methods, not set methods, as the set methods create lots of room for abuse. Re-writing can be done by copying, so you shouldn't need the setters. Does that make sense?
Doug
--
To unsubscribe, e-mail: <mailto:lucene-dev-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:lucene-dev-help@;jakarta.apache.org>
