16

I want to understand the logic or algorithm behind the search functionality in Magento Connect when the Sort by option in Refine search is set to sort by Relavence

2
  • Do you mean the Magento Connect website?
    – SR_Magento
    Commented Aug 21, 2015 at 11:09
  • Yes @sr_magento Commented Aug 21, 2015 at 15:01

2 Answers 2

8
+25

I would suppose that search is implemented using MySQL FULLTEXT index.

Here is a quote from MySQL official documentation regarding to how that index works:

Rows returned are automatically sorted with the highest relevance first. Relevance values are nonnegative floating-point numbers. Zero relevance means no similarity. Relevance is computed based on the number of words in the row, the number of unique words in that row, the total number of words in the collection, and the number of documents (rows) that contain a particular word.

As a proof of that you can try to perform a search on Magento Connect website using the following search terms:

  1. Slider
  2. Order
  3. SEO

For the first term the first results are modules with titles:

  1. I-Slider - Banner Slider
  2. Product Slider Pro | Multiple Sliders | Responsive Slider

For the second:

  1. Order - Order Reminder

For the last one:

  1. SEO ― Advanced SEO Suite

As you can see in all cases the first items have more than one occurrence of search term in the title so relevance of them is higher.

Seems like that is how Magento Connect search works.

1
  • Not a bad guess, Alex. Though I suppose it assumes connect is built on top of the same underlying stack as Magento, which may not be the case. Hoping @BenMarks chimes in Commented Aug 24, 2015 at 16:10
3

While Magento.com is built upon Drupal, Magento Connect seems to be using Magento itself, at least as foundation.

Evidence:

With this information, we can concur that the search works the same way as in Magento Enterprise. Now there are several possibilities:

  • MySQL LIKE search
  • MySQL FULLTEXT search
  • MySQL combined search
  • Solr

As you can see if you search for arbitrary search term combinations, it's not the default LIKE search with OR that everybody hates. So either it's the fulltext search that orders by relevance by default, as suggested by @alex_b or the Solr search of the Enterprise_Search module, for which I probably am not allowed to disclose details.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.