P
P
psyloss2011-10-12 20:14:32
Sphinx
psyloss, 2011-10-12 20:14:32

Sphinx: get number of mva attribute values?

Good evening!
Help me please. I've already broken my head.
There are products, there are reviews of products. There are two fields in the search form: “request” and a checkbox “search
with reviews only”. You need to find products whose names OR comments
contain the search query. In this case, the checkbox must be taken into account. And that's exactly what doesn't
work. I made an mva-attribute with a list of id reviews, but how to get an attribute containing the
NUMBER of reviews? To further filter by the value of this attribute.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Shedar, 2011-10-12
@Shedar

I would just put in an attribute for the number of reviews.
The advantage compared to mva is that the usual attributes are preserved after updates, i.e. to change the number of reviews, you do not have to re-index products.

P
psylosss, 2011-10-12
@psylosss

Solved the problem using stored functions: get_comments_count(product_id) and get_positive_comments_count(product_id). Something did not turn out very elegantly, but it works ... Maybe there is still a solution in the plane of the sphinx? it would be much more convenient

K
klirichek, 2014-01-16
@klirichek

MVA is not vector but set.
It does not save everything in a row, as it was put in - but only unique values ​​in ascending order:
- insert into the attribute (10,10,11,11,43,43,12,12)
- in fact you get there (10,11,12, 43)
In principle, you can make a union in general and define two fields in the index - description and "reviews" (the second is joined_field from all reviews for this product) related to a particular product).
id-shki reviews (if suddenly needed) can be put in mva. In the same place put a separate attribute with their number.
It turns out a scheme like:
a_product_id, f_description, f_joined_feedbacks, mva_feedbacks_ids, a_feedbacks_count

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question