Hi Sid
The issue here is that you're using field-specific matching, which doesn't play
nicely with the phrase match mode.
Instead, try the following:
Video.search('@(title,description) "copper mountain"',
:match_mode => :extended,
:with => {:active => true, :is_partner => true},
:order => "popularity DESC",
:page => params[:page],
:per_page => 10
)
You can match on phrases within extended match modes, just by using quotes. The
above query should do the trick.
Cheers
--
Pat
On 01/06/2010, at 3:09 PM, smeed652 wrote:
> Here is my index:
>
> define_index do
> #indexes [:cached_tag_list, :description], :as => :keywords
> indexes rg_keywords, :as => :taxonomy_tags
> indexes title, sortable => true
> indexes description, sortable => true
> indexes tag_list
> has active, is_partner, provider_id, popularity,
> randomized_popularity, view_count, rating, created_at, updated_at,
> published_at
> end
>
>
> Here is my search call:
>
> @videos = Video.search("@(title,description) copper
> mountain",:match_mode => :phrase,
> :with => { :active => true, :is_partner => true},
> :order => "popularity DESC", :page =>
> params[:page], :per_page => 10)
>
> Thanks!
>
> Sid
>
>
>
> On May 31, 4:59 pm, Pat Allan <[email protected]> wrote:
>> What does your search call look like?
>>
>> --
>> Pat
>>
>> On 01/06/2010, at 2:21 AM, smeed652 wrote:
>>
>>> Do I need to do anything special to get :match_mode => :phrase to
>>> work. I have an index of content where the text "Copper Mountain" is a
>>> name of an article. I also have articles with "mountain" and "copper"
>>> in them. When I set the search to ":match_mode => :extended", I get
>>> all of the articles that include the terms. What I really want is
>>> match the phrase "copper mountain" only and not see the other
>>> articles. So I tried using :match_mode => :phrase but it doesn't
>>> return anything.
>>
>>> Anybody of suggestions?
>>
>>> Thx
>>
>>> --
>>> 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
>>> athttp://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.
>
--
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.