On Dec 2, 2005, at 6:21 PM, John Powers wrote:
Hello,
Lucene only lets you use a wildcard after a term, not before, correct?
What work arounds are there for that?
If I have an item 108585-123
And another 332323-123
How can I look for all the -123 family of items?
To clarify something that no one else has mentioned, its only
QueryParser itself that prevents terms from beginning with a wildcard
character. WildcardQuery itself supports this. The reason
QueryParser prevents it is to avoid runaway queries, as the
underlying mechanism iterates through all terms in the index,
optimizing it for the terms that begin with the static prefix. With
a leading wildcard character, there is no static prefix so literally
all terms in the index are checked.
So, you could try:
Query query = new WildcardQuery(new Term("fieldname", "*-123"));
and see if the performance is acceptable.
Erik
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]