How can I join two cascading many-to-many relationships ?
I have 5 tables :
ITEMS : id / name
ITEMS_TAXONOMIES : id / item_id / taxonomy_id
TAXONOMIES : id / attribute_id / adjective_id
ATTRIBUTES : id / name
ADJECTIVES : id / name
I need a single SELECT to retrieve all associated attribute-adjective pairs for a specific item.
I’m working with Sphinx search engine and I need to look for WORDS associated with the items.
Thank you for your hints…
(Copy of my answer already made on the sphinx forum)
The simplest solution I think would be
Just to search the words you dont need to use sql_attr_multi. You might get a slight
performance boost doing the indexing via sql_joined_field, but the above is simpler so
try that first. Or you could put the attributes and adjectives in seperate fields. But
the above has the benefit can search “attribute bar” to get a specific taxonomy.
You could stick taxonomy_id into a MVA if you want to group or get back the list of
relevent taxonomies for the document in the result.