Question

In my config file ..

sql_query = select pr.id, pr.sf_skus, pr.name, pr.description, pr.sf_vendors,
            pr.sf_product_kw, \
            pr.sf_family_kw, pr.sf_class_kw, pr.sf_group_kw, pr.sf_category_kw, \
            pr.sf_sku_descriptions, \
            pc.item_category_id, pc.item_group_id, pc.item_class_id, \
            pc.item_family_id \
            from products as pr \
            left join product_cats as pc on pc.product_id = pr.id

sql_attr_uint = item_category_id
sql_attr_uint = item_group_id
sql_attr_uint = item_class_id
sql_attr_uint = item_family_id

when i run ....

search --filter item_family_id 12

I get a total of 26 documents found.

on the database when i run (the exact same query (i think))...

select pr.id, pr.sf_skus, pr.name, pr.description, pr.sf_vendors, pr.sf_product_kw,
pr.sf_family_kw, pr.sf_class_kw, pr.sf_group_kw, pr.sf_category_kw,
pr.sf_sku_descriptions,
pc.item_category_id, pc.item_group_id, pc.item_class_id,
pc.item_family_id
from products as pr
join product_cats as pc on pc.product_id = pr.id

where pc.item_family_id = 12

I get 41 results.

Shouldn't these two be identical? What am i doing wrong. TIA

Was it helpful?

Solution

First of all you use different joins (LEFT JOIN in first query and JOIN in second). Second, you can run mysql client and watch to your index content using:

SELECT * FROM your_index LIMIT 100; 

It can be that your query to sphinx returns only part of results.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top