Err, I'm more than a little surprised that code works.
* Sphinx is fine with a single array of values, but not arrays within
arrays
* Sphinx can't (yet) filter on strings. That's upcoming in 0.9.10,
apparently.
The following syntax is fine:
Tree.search 'sapling', :with => {:variety => [1, 2, 3]}
But I wouldn't expect this one to work reliably:
Tree.search 'sapling', :with => {:variety => 'pine redwood'}
Let alone your more complex example...
From a Sphinx API perspective, you can't send through arrays of
arrays, or strings, when it comes to filters. So, if you're getting
the right results, I'd personally put it down to some fluke in Sphinx.
Don't make any assumptions on this working for production sites.
--
Pat
On 28/07/2009, at 9:49 AM, elijah wrote:
>
> My nomination for "best undocumented feature" is this: you can pass an
> array to :with.
>
> By using an array you can generate complex boolean conditions.
>
> For example:
>
> To search for variety is "pine OR redwood"
>
> Tree.search "sapling", :with => {:variety => 'pine redwood'}
>
> To search for variety is "(pine OR redwood) AND (evergreen)"
>
> Tree.search "sapling", :with => [['variety', 'pine redwood'],
> ['variety', 'evergreen']]
>
> It took me a while to figure that out. I hope it helps someone else.
> Browsing the archives, it seems that this question has been asked in
> the past, although answered unsatisfactorily.
>
> -elijah
>
> >
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---