P
P
Pavel Gogolinsky2017-02-07 12:25:28
MySQL
Pavel Gogolinsky, 2017-02-07 12:25:28

How to index products with their attributes in sphinx?

Products have attributes that need to be filtered. Attributes are stored as EAV. How would you index products along with attributes? Compose one sql_query? I tried

SELECT p.id as id, p.title as title, p.address as address, p.category_id as category_id, p.price as price, p.area as area, p.district_id as district_id, av.value as value, av.option_id as option_id, av.attribute_id as attribute_id
FROM product p
LEFT JOIN eav_attribute_value av ON p.id = av.entity_id

But it turns out that one product row is duplicated for each attribute value (there are as many rows with one product as there are attributes for this product). Sphinx cuts duplicates. How to proceed?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
shagguboy, 2017-02-07
@gogolinsky

1) as many left joins as properties
2) unload in xml and drive it into the sphinx already.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question