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] <javascript:> 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] <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