开发者

Setting wildcard queries as default for QueryParser

开发者 https://www.devze.com 2022-12-30 03:47 出处:网络
When my users enter a term like \"word\" I would like it be treated as a wildcard query \"word*\" so all开发者_如何学Go terms beginning \"word\" are found. Is there a way to tell the QueryParser to au

When my users enter a term like "word" I would like it be treated as a wildcard query "word*" so all开发者_如何学Go 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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消