Hi Nicola
I think you're not quite understanding the purpose of :with_all - it matches
any documents that have all of the given values for an attribute in *each*
document...
So, your first example is asking for Items that have a user_id of 1, 2 *and* 3
- given an Item can only have a single user_id, it's impossible for it to have
all three values at the same time.
:with, on the other hand, will match Items with user_ids of 1, 2 or 3 - which
I'm guessing is what you want?
Item.search :match_mode => :full_scan, :with => {:user_id => [1,2,3]}
Cheers
--
Pat
On 02/08/2011, at 5:26 AM, zetarun wrote:
> Hi all,
> I'm trying tu use :with_all in a search query in a single value
> attribute but I have some problems with array values. It seems that
> this kind of filter works only for multivalue attributes.
>
> So, for instance, given :user_id as a single value attribute, the
> following string produces no results
>
> Item.search :match_mode => :full_scan, :with_all => {:user_id =>
> [1,2,3]}
>
> but the following does:
>
> Item.search :match_mode => :full_scan, :with_all => {:user_id => 1}
>
> I'm missing something...or is a lack of a feature or a bug?
>
> Thank you very much,
> Nicola.
>
> --
> 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.