Re: Wildcard vs Term query

2007-09-26 Thread Erik Hatcher
WildcardQuery won't be slower than TermQuery if there are no wildcard characters. Beyond what QueryParser does, WildcardQuery itself reverts to a TermQuery: public Query rewrite(IndexReader reader) throws IOException { if (this.termContainsWildcard) { return super.rewrite(r

Re: Wildcard vs Term query

2007-09-26 Thread John Byrne
I'm not using the QueryParser at all. I need to do a little more with the terms, so i'm explicitly creating a Query from a single term. What I was hoping was to avoid something like this: ... if(term.contains("*") || terms.contains("?") { return new WildcardQuery(... } else { return new T

Re: Wildcard vs Term query

2007-09-26 Thread mark harwood
Are you using the out of the box Lucene QueryParser? It will automatically detect wildcard queries by the presence of * or ? chars. If the user input does not contain these characters a plain TermQuery is used. BooleanQuery.setMaxClauseCount can be used to control the upper limit on terms produ