I did such search,
` Comment.search "aabbb "`
and I want to get the results which contain "ab" too.; So I did that way:
` Comment.search "aabbb ab"`
but I found the results aabbb
and ab
are mixed , in fact, I want to make the results which match aabbb
shows before ab
, in other words, have a higher priority.
I know sphinx can add weight the fields of the table. for example add 10 to comments's name, 20 to comment's content. but is it possible to add weight to the query works?
Sphinx has no ability to weight certain search phrases, I'm afraid - so what you're trying to do is not possible.
It's also worth noting that Sphinx uses AND logic by default - if you want results that match either aabbb OR ab, you'll probably want to use the :any match mode:
Comment.search "aabbb ab", :match_mode => :any