views:

38

answers:

1

When my users enter a term like "word" I would like it be treated as a wildcard query "word*" so all terms beginning "word" are found. Is there a way to tell the QueryParser to automatically create wildcard queries or do I have to parse the query myself? This shouldn't be a problem for simple queries but it may become tricky for more complex queries.

A: 

Unless I am missing something - a wildcard query for every query is usually inadvisable - it is very expensive and could cause a lot of problems. If you are trying find results including variants of a stem (e.g. win -> winner, winning, etc.) You should consider a n-gram approach.

Mikos
Mikos, I have done some testing and in my particular scenario (this is a desktop app with only one search being executed at a time), I don't notice any performance problems when I exclusively use wildcard queries. N-grams are new to me. I'll look into it.