开发者

Wildcard (*) Searches With Thinking Sphinx

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜