Hi,
I am unsuccessfully trying to apply several AND filters on different
attributes of a join table. In other words, I want to ensure that all
attribute conditions are met by a single row of the join table.
Unfortunately, Thinking Sphinx uses GROUP_CONCAT to include associations in
the index. Therefore, TS evaluates attribute conditions one at a time on
the overall join table.
I am searching on Model A, which has many model B associated. Model B has
attribute1 and attribute2.
I want to filter attribute1 < 10 and attribute2 > 30 at a row level.
I have the following Model A data: [id: 1, modelb: {{attribute1: 5,
attribute2: 20}, {attribute1: 15, attribute2: 40}}]
I create a TS index on model A:
has modelb(:attribute1), :as => :attribute1
has modelb(:attribute2), :as => :attribute2
This index will convert my data into something like: [id: 1, attribute1:
{5, 15}, attribute2: {20, 40}]
Therefore, when I execute the search with filters "attribute1 < 10 AND
attribute2 > 30", TS will incorrectly return model A.
The question is: how can I tell Sphinx to evaluate several AND conditions
on the join table, ensuring that the conditions are fulfilled by a single
row of the join table?
Thanks!
--
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.