Hmm, maybe there shouldn't be a space between field names?
@(actor_name,director_name)
--
Pat
On 05/06/2009, at 10:19 AM, phil wrote:
>
> It seems that the problem is with the name query...
>
>>> films = Film.search 'clint eastwood'
>>> films.total_entries
> => 198
>
>>> films = Film.search :conditions => {:actor_name => 'clint eastwood'}
>>> films.total_entries
> => 157
>
>>> films = Film.search :conditions => {:director_name => 'clint
>>> eastwood'}
>>> films.total_entries
> => 102
>
>>> query = "@(actor_name, director_name) #{name_query}"
> => "@(actor_name, director_name) clint eastwood"
>>> films = Film.search query, :match_mode => :extended
> => []
>
> Perhaps once that works then, Pat, your way would work!
>
> On Jun 5, 3:28 pm, Pat Allan <[email protected]> wrote:
>> Put the two queries together should do the trick - AND is implicit.
>>
>> "@(title_en,title_es) #{title_query} @(actor_name, director_name)
>> #{name_query}"
>>
>> Cheers
>>
>> --
>> Pat
>>
>> On 05/06/2009, at 7:41 AM, phil wrote:
>>
>>
>>
>>> Sorry - again with the newbie questions!
>>
>>> I have a model:
>>
>>> class Film
>>> define_index do
>>> indexes participants(:name), :as => :actor_name
>>> indexes directors(:name), :as => :director_name
>>> indexes :title, :as => :title_en, :sortable => true
>>> indexes titles_es.title, :as => :title_es, :sortable => true
>>> end
>>> end
>>
>>> How do I search for all films with the word 'midnight' in the title
>>> AND have 'clint eastwood' as an actor or a director?
>>> I can't figure it out.
>>
>>> I can do the word midnight in either title_en or title_es:
>>> "@(title_en,title_es) #{title_query}"
>>> or clint as actor or director:
>>> "@(actor_name, director_name) #{name_query}"
>>
>>> but how can I 'AND' these two queries?
>>
>>> Thanks for any help!
> >
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---