Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7446781
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T12:24:40+00:00 2026-05-29T12:24:40+00:00

I noticed that I seemingly wasn’t able to sort on relevance in a default

  • 0

I noticed that I seemingly wasn’t able to sort on relevance in a default search. Whether I tried ASC or DESC, the results were always the same and rather poorly relevant at that.

Upon further investigating, I found the addSearchFilter() method in Mage_CatalogSearch_Model_Resource_Fulltext_Collection :

/**
 * Add search query filter
 *
 * @param string $query
 * @return Mage_CatalogSearch_Model_Resource_Fulltext_Collection
 */
public function addSearchFilter($query)
{
    Mage::getSingleton('catalogsearch/fulltext')->prepareResult();

    $this->getSelect()->joinInner(
        array('search_result' => $this->getTable('catalogsearch/result')),
        $this->getConnection()->quoteInto(
            'search_result.product_id=e.entity_id AND search_result.query_id=?',
            $this->_getQuery()->getId()
        ),
        array('relevance' => 'relevance')
    );

    Zend_Debug::dump($this->getData());exit;

    return $this;
}

The result of my data dump shows the results just fine, but the ‘relevance’ column is always 0.00000. I have not made any changes to the catalog search and this is Magento 1.6.0.

I dumped the actual SQL as well:

SELECT `e`.*, `search_result`.`relevance` FROM `catalog_product_entity` AS `e` INNER JOIN `catalogsearch_result` AS `search_result` ON search_result.product_id=e.entity_id AND search_result.query_id='33'

If anyone else has more experience with calculating relevance I would greatly appreciate direction.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T12:24:41+00:00Added an answer on May 29, 2026 at 12:24 pm

    Short answer: the relevance is only used in full text search mode.

    Background

    In the admin interface you can configure a “Search Type” for Magento.
    This setting can be found under System > Config > Catalog > Catalog Search > Search Type

    If switched to Fulltext (and after reindexing), and clearing the catalogsearch_query table, Magento will use the MySQL Fulltext Search capability, specifying a WHERE condition in the query as follows:

    ...MATCH (s.data_index) AGAINST (:query IN BOOLEAN MODE) AS `relevance`...
    

    This will return a floating point number that will be used as the relevance value. A plain hit will give you a relevance of 1. If the index contains the search term more then once, it will be given a higher relevance.

    Also the boolean fulltext search enables the use of search modifiers like “+this -notThis”.
    More information on the relevance weighting of the MySQL boolean fulltext search can be found here http://dev.mysql.com/doc/refman/5.1/de/fulltext-boolean.html

    If the search mode “Like” is used, the relevance always is 0 (as you noticed).

    Indexing

    The way Magento builds the search index isn’t very intuitive, I recommend a look at the table catalogsearch_fulltext. Then tune the attributes you want to use in the search by adjusting the Used in Quick Search property for them. This setting can be found under Catalog > Attributes > Manage Attributes. Then reindex the catalog search index.
    I also recommend clearing out the catalogsearch_result table after you adjust the attributes.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I noticed that various systems use various characters as the replacent for illegal ones
I noticed that on my Vista and XP machines, the automatic update is asking
I noticed that JavaScript's new Date() function is very smart in accepting dates in
I noticed that every time that I restart my computer I have to do
We noticed that when testNG test cases extend TestCase (JUnit) those tests start executing
I noticed that most scripts for e-mail validation do not use DNS information to
I noticed that the fact tables used in a cube were actually views. Infact
I noticed that Feedzirra uses this regex to get the ETag from response header:
I noticed that when you call a superclass's methods, you need to do something
I noticed that a lot of sites send a random token with form posts

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.