Reputation: 86
I am using Magento 1.5.1 and all of the sudden, the search results stopped being returned. I found a fix that worked for me for a couple of days at http://www.optimiseblog.co.uk/magento-catalog-search-broken-not-working/.
The real kicker is that after no more than 2 or 3 days, THAT solution stopped working and now returns no results. I have scoured every single Google search result that could be remotely relevant and haven't found anything else that comes close to solving this problem.
My products are enabled, visibility is set to search or catalog/search for the products, and i have refreshed the cache and re-indexed multiple times. I could really use some help with this. Thanks in advance.
Upvotes: 2
Views: 9431
Reputation: 304
This can also happen when there are cached search terms. If clearing caches and rebuilding/refreshing indexes doesn't work, try deleting the search terms. If you rely on the search terms to return search results this will break that functionality, but if you don't, then it will be OK.
I've run into this problem several times while building custom indexes and using SOLR where Magento still caches search results, regardless if it should or shouldn't. I've built a customer indexer to give granular control over search terms as well as significant performance gains for generic fulltext searches.
Upvotes: 0
Reputation: 6140
I had the no products returned on search problem on Magento 1.8.1, and solved it by setting 'is_anchor' to true on the default category (id 2), and then reindexing category product.
Underneath the hood, the number of search results are returned by a query roughly like:
SELECT COUNT(DISTINCT e.entity_id) FROM `catalog_product_flat_1` AS `e`
INNER JOIN `catalogsearch_result` AS `search_result`
ON search_result.product_id=e.entity_id
AND search_result.query_id='11'
INNER JOIN `catalog_category_product_index` AS `cat_index`
ON cat_index.product_id=e.entity_id
AND cat_index.store_id='1'
AND cat_index.visibility IN(3, 4)
AND cat_index.category_id = '2';
It was the join on catalog_category_product_index where category_id = 2 that was blocking results. That category was not included in the index.
Making the category an anchor and reindexing fixed the problem.
Upvotes: 3
Reputation: 12727
bleacherbum17 (OP) already self-answered the question.
Quote:
Actually, I think I just figured it out. I swear that I had tried this before, but this time it worked. All I had to do was go to Index Management then refresh any that needed it, then Select All->Rebuild. After that, go to Cache Management->Select All->Refresh. Then flush both caches. For some reason, this worked.
I think it has to do with actually refreshing all indexes and caches regardless of whether their status says it is needed or not. I even have indexing disable for now while I am building the site, but selecting all and refreshing them, then emptying the caches worked.
Note: It's absolutely OK to self-answer your own question. Please just post it as an real answer, but not in a question or comment. Posting as real answer helps to keep the "Unanswered" list more clear (avoids making other people wasting their time). Thank you.
Upvotes: 5