Magento Search Not Working

Today I came across a really annoying issue with respect to Magento’s search functionality. In essence, regardless of the term the user was entering, Magento returned the same 10 products, & occasionally a correct match!

Looking in the search logs of a search extension I installed, I could see that loads of results were being returned but not being displayed in the actual front end results. Could it be a stale index, or a problem with the cache?

Well, after countless command line reindexing, clearing the cache, checking the search settings in Config (Like & FullText), checking that products were visible, etc, I checked on the display values in the categories. There I discovered that the store’s root category’s “Is Anchor” was set to yes, and there were 14 products assigned to the root category. Amongst these 14 products were the usual suspects appearing in the rogue search results!

In the spirit of trying anything, I set “Is Anchor” to No and removed the products. Bang – the search results started working as expected. I’m not sure why but by this time I was past caring tbh! However, it looks like these settings were restricting the products that could be displayed on the front end. Does anyone know the reason?

Update

I had this occur on another site I’m working on – empty search results. This time the culprit was that none of the products that had been imported via a third party system had been assigned to a website/store.