开发者

Wildcard (*) Searches With Thinking Sphinx

开发者 https://www.devze.com 2023-01-07 12:53 出处:网络
Is it poss开发者_JS百科ible to give star () between the search text . Example => peoleThe enable_star option allows prefix matching (\'foo*\') and infix matching (\'*foo*\'). It does not, however allo

Is it poss开发者_JS百科ible to give star () between the search text . Example => peole


The enable_star option allows prefix matching ('foo*') and infix matching ('*foo*'). It does not, however allow you to stick the * in the middle of a word as the question asks. The best simple solution I can suggest for the described case is searching as two words with 'any' matching:

IndexedThingie.search('peo le', :match_mode => :any)

If you specifically need 'all' style matching for everything else, you should look into the expression matching syntax in the Sphinx manual (http://sphinxsearch.com/docs/2.0.1/extended-syntax.html), which is available if you specify the 'extended' match mode (see TS match mode documentation: http://freelancing-god.github.com/ts/en/searching.html#matchmodes). It might be complicated, but with some manipulation of your search input, you should be able to manage it. In particular, look at the 'strict order' operator, '<<'.

IndexedThingie.search('peo << le', :match_mode => :extended)


Yes. enable_star: 1 or enable_star: true in your sphinx.yml.

0

精彩评论

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

关注公众号