You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by Daniel Naber <lu...@danielnaber.de> on 2005/12/10 00:46:44 UTC

Query.extractTerms

Hi,

Query.extractTerms throws an exception if called with a non-rewritten 
query. Is it enough to document that (I could do that) or is that 
something that should be fixed (if possible)?

BTW, the API is "public void extractTerms(Set)", wouldn't this be more 
natural?: public Set extractTerms()

Regards
 Daniel

-- 
http://www.danielnaber.de

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


Re: Query.extractTerms

Posted by Chris Hostetter <ho...@fucit.org>.
:
: Query.extractTerms throws an exception if called with a non-rewritten
: query. Is it enough to document that (I could do that) or is that
: something that should be fixed (if possible)?

That seems like something that should be a checked Exception (not a
RuntimeException)

Alternately, extractTerms could take in an IndexReader and do it's own
rewriting.  (it's new since 1.4.3 so there's no major harm in changing the
signature.

: BTW, the API is "public void extractTerms(Set)", wouldn't this be more
: natural?: public Set extractTerms()

The advantage of having the Set passed in is that the client can choose
it's own implementation based on it's intended use (ie: if i'm going to
iterate over the results in multiple threads, i may want a
CopyOnWriteArraySet; if i just want fast lookups, i may want a HashSet).
Not to mention the fact that this way, if i want a the set of all terms in
many, many Queries, i can use the method as is to keep adding the terms
into a single set, instead of getting back several and merging them later.



-Hoss


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