Answer the question
In order to leave comments, you need to log in
Sphinx and multi attributes as an array
There is a database:
In Sphinx, the t_person index is built on it
Source config:
with category multi-attribute — a list of product categories that this person has.
Is there a way to add information about the number of products in each category for the current person to the current index?
For example, I would be satisfied if the search by index returned not a list of categories, but an associative array category => number of products, but multi-attributes in the sphinx support only INT && TIMESTAMP
The obvious option of storing the number of products for a person in a separate database table is considered, but separately Whether, now I think it is possible to manage a sphinx.
source t_person {
...
sql_query = SELECT id, name FROM t_person
...
}
...
sql_attr_multi = uint category from ranged-query; \
SELECT `pp`.`people`, `pc`.`category` \
FROM `t_product_people` `pp`
INNER JOIN `t_product_category` `pc` ON `pc`.`product` = `pp`.`product` \
...
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