lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From karl wettin <ka...@snigel.net>
Subject Re: Exception in WildCardQuery
Date Sat, 08 Apr 2006 18:06:07 GMT

8 apr 2006 kl. 19.04 skrev Erick Erickson:

> I have to disagree.

> Optimization where it really doesn't count is, in my experience, bad.
> Period.

My intent was not to ephasise on optimization. The waste of  
clockticks is just a side effect from what I consider bad design.  
WildcardQuery and TermQuery do diffrent things. If I want to  
encapsulate the functions of both in one class I write a factory.

class TermOrWildcardQuery implements Query {
	private Query factory(Term t) {
		if (t.termText.endsWith("*")) return new WildcardQuery(t); else  
return new TermQuery(t);
	}
}


I have never used such a factory, but my guess is that  
programmatically I would always know If I wanted to use a wildcard or  
not. So only when writing a primitive query parser for human entered  
text could I see the use for such a thing. Perhaps then it is then  
better to write a real parser/lexer using Antlr or JavaCC?

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


Mime
View raw message