search relevance

How do I check Magento's Search Relevance scores to see what IT thinks is relevant?

Refine Magento search's targeting selection to be as crafty as a Predator Drone!

Magento's stock search is pretty basic, and although it offers a "sort by relevance" feature I often can't tell what it was thinking from the order of the result set. So I decided to hit the database directly and dump out the weighted scores to view them numerically. Now, this doesn't "dix" anything - but at least it gives me the ability to adjust the indexing algorithm and see the results of my efforts.

The following code will do just that:

SELECT prodName.`value` AS name,
MATCH (searchIndex.`data_index`) AGAINST (' ') AS relevance
FROM catalogsearch_fulltext AS searchIndex

LEFT JOIN catalog_product_entity_varchar AS prodName
ON prodName.`entity_id` = searchIndex.`product_id` AND prodName.`attribute_id` = (SELECT attribute_id FROM eav_attribute WHERE attribute_code = 'name' AND entity_type_id = 4)

ORDER BY relevance DESC;


Subscribe to RSS - search relevance