Hi Steve
You may want to look at having a second index, with just the name in it, and
then you should be able to rank that index a bit higher.
define_index 'business_name' do
indexes name
end
And then for searching:
Business.search 'burger bar', :index_weights => {'business_name_core' => 10}
Any indexes not mentioned have a default weighting of 1. The only catch with
this is that 'burger bar' will match 'Burger Bar', 'Bar Burger', and 'Just
Another Burger Bar'. Still, maybe that's good enough for what you need to do?
There's no special attribute for exact matches, I'm afraid, so you can't factor
it in to the custom sorting algorithm. And this is all theory - I've not tried
it myself, but I think it's worth a shot.
Cheers
--
Pat
On 05/01/2010, at 5:59 AM, Steve H wrote:
> Hi Pat and other sphinx experts:
>
> We're indexing businesses by name and category (and some other
> fields). We want to ensure that something that matches *exactly* in
> name or category will be boosted above something that is a partial
> match or match across fields (ie, if I search for "Burger Bar" in Las
> Vegas, the business by the name of "Burger Bar" should be returned
> above the business "Al's Bar" that has also been categorized as
> "Burgers", also above something like "Johnny's Bar and Burgers").
>
> We're doing expression sorting, so we would need to be able to do
> something like "+ @exact_match*10", where @exact_match would be 1 if
> it's an exact match or 0 otherwise. That's just what I was hoping for
> -- any way to achieve a similar result would be spectacular.
>
>
> Thanks,
> Steve
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Thinking Sphinx" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/thinking-sphinx?hl=en.
>
>
--
You received this message because you are subscribed to the Google Groups
"Thinking Sphinx" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/thinking-sphinx?hl=en.