On Thursday 28 August 2003 21:54, Brian Campbell wrote: > Basically, yes, I am trying to put a wildcard in a phrase. My field (a > Keyword) is the name of a project. It can be 40 characters long (I'm > basically indexing some database columns). Since it is a Keyword and not a > Text field, it doesn't get tokenized (I do this on purpose) and must match > up exactly. I would like for users to be able to search on partial phrases > such as "Hello w*" and match up to "Hello world" and "Hello washington", > etc. Is this not possible? Is it documented anywhere?
This can be done, AFAIK. This is one thing that many people seem unaware of: you don't HAVE to use QueryParser to build queries. In your case it seems like you should be able to construct query you want if you either by-pass QueryParser, or create a dummy analyzer (one that does no tokenization but returns all input as one token). Since QueryParser is fairly simple class, you should be able to see how wild card queries are constructed. You can not (and need not) create a phrase query since it does not allow wild cards (like someone pointed out), but since the whole phrase is just one token for keyword fields, you can use normal wild card query (or prefix for cases like "Hello w*"). It would be nice if FAQ could point out that QueryParser is higher-level interface to query part, but it is possible and sometimes necessary to do your own query construction. I think it's very cool Lucene queries were properly modularized this way -- too many open source projects have components too tightly coupled. -+ Tatu +- --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]