For now, I was able to fix the issue by moving my primary key value to start at 10000. The table I'm working with will likely never have more than a few hundred entries so this should be safe, but it would be nice to understand what may be driving the issue with the search.
On Wednesday, December 17, 2014 11:28:18 AM UTC-6, Josh Lehman wrote: > > I have a model where an object can have multiple traits (similar to > "tags") related to them. I have a has_many relationship through a reference > table to match trait ID's back to a constituent. > > In order to facility all the various search conditions I want to offer > (ANY, ALL, NOT) I have traits set up as an attribute and I reference it in > my search in one of 3 ways. > > If the user opts for an "Any" search, I use a normal "with" trait_id in an > array of elements. > > If the user opts for "All" I, instead, do a "with_all" condition that > includes both trait_id values, as per the below: > > SELECT * FROM `constituent_core`, `constituent_delta` WHERE > `sphinx_deleted` = 0 AND `trait_id` = 1 AND `trait_id` = 7 ORDER BY > `created_at` DESC LIMIT 0, 25 OPTION max_matches=100000 > > The problem lies in the fact that when the with_all is done, I'm getting > not only records with trait_id 1 and 7 but also ANY record with a trait_id > that INCLUDES a 1 in the integer. So I'm getting all trait_id values of > 11,12,13,14,15, etc I assume because they also contain a "1". > > Wondering if I'm doing something wrong in how I create my "with_all" > conditions. Is there an "exact" flag I need to set? My index for this > parameter looks like this: > > has traits.id, :as => :trait_id, :type => :integer > > Also, my "ANY" search condition which uses the "with" parameters also > returns all the additional trait ids as well. > > I'd never really experienced this before BUT this is also the first time I > think I've used a WITH or WITH_ALL param set on an ID where values exist > above 9. In the past I'd only used it on field status columns where the > ID's ranged from 1 to 6 max and this the issue never appeared. > > > > > -- 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/d/optout.
