Hi Pat,

I agree, It would be better upgrade it.

Could you explain me, please, in detail what do you mean about: *And 
passing nil in won’t work, I’m afraid - an empty set is different to 
matching a nil value in a set. ?*

I say so because, It's seems to work in my case.

I mean: with a filter like this with: { product_ids: ids } -> [1,2,3,4] 
obviously I can't find record (Digital assets) without a product 
association.

But If I pass this array [1,2,3,4,nil] my search results include those 
Digital assets without of an explicit product association. And It's what I 
want.

But I'm afraid of doing something wrong without see it

Bye.

Il giorno lunedì 3 febbraio 2014 12:29:20 UTC+1, Pat Allan ha scritto:
>
> Hi Yuri
>
> It’s Sphinx that you definitely need to upgrade - but I’ve no idea if TS 
> v2.0.14 will work with Sphinx 2.1.x. You could give it a shot, I guess? 
> Note that the :select option becomes :sphinx_select with TS v2.0.14.
>
> And passing nil in won’t work, I’m afraid - an empty set is different to 
> matching a nil value in a set.
>
> — 
> Pat
>
> On 3 Feb 2014, at 8:49 pm, [email protected] <javascript:> wrote:
>
> Uhm ... unfortunately I'm using TS 2.0.14
>
> Could be a problem?
>
> Is it possibile to do it without upgrading the GEM?
>
> Thanks.
>
> Il giorno lunedì 3 febbraio 2014 10:46:07 UTC+1, [email protected] ha 
> scritto:
>>
>> Hi Pat, thanks again for your support.
>>
>> Probably is a stupid question but .... is not possible to pass simply a 
>> nil value in the array?
>>
>> I mean: instead of prod_ids = [1,2,3,4,5] -> [1,2,3,4,5,nil]
>>
>> Bye.
>>
>> Il giorno sabato 1 febbraio 2014 00:32:26 UTC+1, Pat Allan ha scritto:
>>>
>>> Hi Yuri 
>>>
>>> It’s certainly possible, but more complex - you’ll need to construct the 
>>> filter in a more manual manner. I think the following will work: 
>>>
>>> Digitalasset.search( 
>>>   select: "*, LENGTH(product_ids) = 0 OR IN(product_ids, #{ids.join(‘, 
>>> ‘)} AS in_products”, 
>>>   with: {in_products: true} 
>>> ) 
>>>
>>> Though you need to be using Sphinx 2.1.2 or newer (that’s when the 
>>> LENGTH function was introduced to Sphinx). 
>>>
>>> If you’re using Thinking Sphinx v3.0.6, that’ll work, but you’ll need to 
>>> make changes as outlined in the release notes: 
>>> https://github.com/pat/thinking-sphinx/releases/v3.0.6 
>>>
>>> Or, you can upgrade to v3.1.0, which works with Sphinx 2.1.x releases as 
>>> the default. A read of the release notes for other changes wouldn’t hurt: 
>>> https://github.com/pat/thinking-sphinx/releases/v3.1.0 
>>>
>>> Cheers 
>>>
>>> — 
>>> Pat 
>>>
>>> On 1 Feb 2014, at 1:28 am, [email protected] wrote: 
>>>
>>> > Hi all, 
>>> > for first sorry for my english. 
>>> > 
>>> > I've 3 tables in my DB 
>>> > - digitalassets 
>>> > - product_digitalassets 
>>> > - products 
>>> > 
>>> > the 2nd table is a join table in a M:N relationship 
>>> > 
>>> > I collect documents through digitalassets table and I've created an 
>>> attribute field in my Index: 
>>> > 
>>> > as product_digitalassets.product_id, :as => :product_ids 
>>> > 
>>> > in order to filtering the resultset. 
>>> > 
>>> > In fact I send to search the query command: 
>>> > 
>>> > with: { product_ids: ids } where ids is an array of product ID 
>>> > 
>>> > Everything is ok but now I want to retrieve not only the Digitalassets 
>>> within the list o product_ids but also the Digitalassets without a product 
>>> association. 
>>> > 
>>> > I mean: 
>>> > 
>>> > Digitalasset 1 -> products [1,2,3] 
>>> > Digitalasset 2 -> products [1,2,4] 
>>> > Digitalasset 3 -> products [5,6,7] 
>>> > Digitalasset 4 -> products NULL 
>>> > 
>>> > How to get the Digitalasset 1, Digitalasset 2 and Digitalasset 4? 
>>> > 
>>> > Now for me is sufficent to search with: { product_ids: [1,2] } -> 
>>> result = Digitalasset 1 and Digitalasset 2 
>>> > 
>>> > But in this way I can not get the Digitalasset 4. 
>>> > 
>>> > Thanks in advance. 
>>> > 
>>> > -- 
>>> > You received this message because you are subscribed to the Google 
>>> Groups "Thinking Sphinx" group. 
>>> > To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to [email protected]. 
>>> > To post to this group, send email to [email protected]. 
>>> > Visit this group at http://groups.google.com/group/thinking-sphinx. 
>>> > For more options, visit https://groups.google.com/groups/opt_out. 
>>>
>>>
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Thinking Sphinx" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] <javascript:>.
> To post to this group, send email to [email protected]<javascript:>
> .
> Visit this group at http://groups.google.com/group/thinking-sphinx.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Thinking Sphinx" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/thinking-sphinx.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to