On Feb 17, 2005, at 5:51 PM, Luke Shannon wrote:
My manager is now totally stuck about being able to query data with * in it.

He's gonna have to wait a bit longer, you've got a slightly tricky situation on your hands....


WildcardQuery(new Term("name", "*home\**"));

The \* is the problem. WildcardQuery doesn't deal with escaping like you're trying. Your query is essentially this now:


        home\*

Where backslash has no special meaning at all... you're literally looking for all terms that start with home followed by a backslash. Two asterisks at the end really collapse into a single one logically.

Any theories as to why the it would not match:

Document (relevant fields):
Keyword<type:203>
Keyword<name:marcipan + home*>

Is the \ escaping both * characters?

So, again, no escaping is being done here. You're a bit stuck in this situation because * (and ?) are special to WildcardQuery, and it does no escaping. Two options I think of:


- Build your own clone of WildcardQuery that does escaping - or perhaps change the wildcard characters to something you do not index and use those instead.

- Replace asterisks in the terms indexed with some other non-wildcard character, then replace it on your queries as appropriate.

Erik


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to