lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Doug Cutting <>
Subject Re: Diffs for enabling query rewriting
Date Tue, 12 Nov 2002 18:59:48 GMT
Sorry its taken me so long to look at these.

Clemens Marschner wrote:
> Enclosed you find the diffs I promised for enabling query rewriting.
> This also enables tools such as the HTML term highlighter
> ( 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 as presented on
> the website I mentioned.

A few issues I spotted:

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 

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?


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

View raw message