Hi Brad

Unfortunately, there's no way to weight specific words in Sphinx. If you could 
create a custom field with the special tags in it, then you could weight on 
that... otherwise, another option is to have an attribute with some indication 
that there are special tags attached to that record, and use that in 
combination with the expression sorting mode:

  Model.search "foo",
    :sort_mode => :expr,
    :order     => '@weight * (special_score)'

http://freelancing-god.github.com/ts/en/searching.html#sorting
http://www.sphinxsearch.com/docs/current.html#sorting-modes

The only catch with this approach is there's no way to set it globally, so 
you'd need to be explicit for every search you want that weighting to apply to.

-- 
Pat

On 19/12/2009, at 12:14 PM, Brad Beattie wrote:

> Lets say we have a bunch of articles each with a bunch of tags. There
> is, however, a special tag like "super-awesome". Is there a way to
> weight results such that articles tagged with "super-awesome" match
> higher than those without?
> 
> set_property :field_weights => {
>      'title' => 100,
>      'author_name' => 90,
>      'body' => 70,
>      'tag_names' => 50,
> }
> 
> ...
> 
>  define_index do
>    indexes title, body
>    indexes tags.name, :as => :tag_names
>    indexes authors.name :as => :author_name
> 
> I don't know if this is doable within Thinking Sphinx.
> 
> --
> 
> 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.


Reply via email to