Ah, I didn't realise you were searching on a specific field - that requires
(and automatically sets) the match mode to :extended.
But, you can use boolean logic in extended mode. What you'll need to do is
split your tags with |'s ie:
"stores | markets | finance"
So, perhaps this snippet this will help:
current_account.interests.split(/\s+/).join(' | ')
Cheers
--
Pat
On 11/03/2010, at 10:15 AM, elioncho wrote:
> Thank you Pat, but I still have a problem. I'm indexing two fields in
> my account model (tags and interests). This fields are fill in by the
> user when he creates his account. My app has to show each account
> which others accounts may interest him. So the app takes the arguments
> on the interests field and searches on the other accounts tags field.
>
> @accounts = Account.search :conditions => {:tags =>
> current_account.interests }, :star => true, :match_mode => :any
>
> The problem is that :conditions doesn't works with :match_mode
> => :any, only :extended. So if the user has as interests (books,
> papers, pencils) and there is an account with tags (papers, pencils)
> the search doesn't gives me any results. How can I get around this
> issue?
>
> Thank you!
>
> On Mar 4, 12:40 am, Pat Allan <[email protected]> wrote:
>> HiElioncho
>>
>> It sounds like you want to match ANY of the words, instead of ALL the words.
>> Sphinx (and Thinking Sphinx) default to ALL - but you can choose other match
>> modes if you'd like, including ANY:
>>
>> Model.search "stores markets finance", :match_mode => :any
>>
>> The docs have a bit more information on
>> this:http://freelancing-god.github.com/ts/en/searching.html#matchmodes
>>
>> Cheers
>>
>> --
>> Pat
>>
>> On 02/03/2010, at 1:55 PM,elionchowrote:
>>
>>> Hi guys,
>>
>>> When I query for 'stores, markets, finance' and I have on my indexes
>>> columns two rows of data with:
>>
>>> - stores
>>> - shirts, pants, lotions, stores
>>
>>> (see 'stores' is in both)
>>
>>> I expect to get these two rows of data as results, but I don't get
>>> anything. The only way to get this two rows of data is by only
>>> querying for 'stores'. Now I wonder, how can I configure thinking
>>> sphinx to fetch for me these two rows of data?
>>
>>> Thank you,
>>
>>> Elioncho
>>
>>> --
>>> 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.