views:

292

answers:

3

Similar Stack Overflow Question

I want users to be able to search through my thinking_sphinx text box a word like wood and have it pull up Wooden and Woodworking. This words fine if the user types in wood*, but if they type in just wood with no * then no results are shown. If there a way to get the results of wood* without having to type in the asterisk. Most users aren't that smart.

+2  A: 

can you append an asterisk at the end of user data before sending it to search?

Ben Hughes
@businesses = Business.search(params[:search] + '*') works well. You can also do @businesses = Business.search('*' + params[:search] + '*') and that way no matter where in the word it is, it will find it. Thanks!
Mike
A: 

I think you could get what you're trying to achieve with wordforms in your sphinx configuration. See the documentation here: http://sphinxsearch.com/docs/current.html#conf-wordforms.

You can utilize more advanced Sphinx configuration with a sphinx.yml file. See the following: http://freelancing-god.github.com/ts/en/advanced_config.html

Ben
+1  A: 

just pass :star => true along ;)

nomynus