Answer the question
In order to leave comments, you need to log in
How to search in Sphinx given a bunch of attributes?
Hello.
There is a MySQL database with several million rows.
The main table in it looks like:
ID | text | ... a dozen flag fields ...
Depending on the checkboxes in the search query form, several more tables of the table type (ID | Parent_ID | Data) can join to it.
Currently, a typical request looks like this:
SELECT * FROM table
JOIN child_table on (table.ID = child_table.Parent_ID)
JOIN child_table2 on (table.ID = child_table2.Parent_ID)
...
WHERE
table.Flag1 = '...'
AND table.Flag2 = '...'
AND child_table.Data = '...'
AND child_table2.Data = '...'
SELECT * FROM table
JOIN child_table on (table.ID = child_table.Parent_ID)
JOIN child_table2 on (table.ID = child_table2.Parent_ID)
...
WHERE
table.Flag1 = '...'
AND table.Flag2 = '...'
AND child_table.Data = '...'
AND child_table2.Data = '...'
AND MATCH(table.Text) AGAINST ('....')
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question