23 votes
Accepted

Catalog Search indexer process unknown error: There is no such engine: mysql2

Run this query UPDATE core_config_data set value = 'mysql' where path='catalog/search/engine'; And run Following commands php -f bin/magento setup:upgrade php -f bin/magento cache:flush php -f bin/...
user avatar
  • 777
21 votes
Accepted

Catalog Search: If only one result, show product view page insted of list view

You need to create a new extension that checks, before rendering the quick search (or advanced search) page if the product collection contains exactly one product. For this let's create a new ...
user avatar
  • 195k
12 votes
Accepted

Magento 2: what is the search_request.xml file used for?

Magento 2 provides a declarative way to describe search request which should be executed. search_request.xml is a part of Query API. This declaration describes: What index should be queried What ...
user avatar
11 votes
Accepted

Magento 1.9.3: every product is displayed in the search in full text mode

Edit: this is not the only 1.9.3.0 bug. See this answer for details and a module that fixes all the bugs: https://magento.stackexchange.com/a/140826/2380 This is a bug. Thanks to IWeb for ...
user avatar
9 votes
Accepted

Search does not return results

Open your file Mage_CatalogSearch_Model_Layer and in method public function prepareProductCollection($collection) before return $this; Add following rows: Mage::log($collection->getSelectSQL(1)...
user avatar
  • 3,768
9 votes
Accepted

How to disable ElasticSearch using terminal?

⚠️ Since Magento 2.4, ElasticSearch is required and MySQL is not supported as a search engine anymore. You can use the Magento 2 CLI to do it, you can check your current search engine using: php -f ...
user avatar
9 votes
Accepted

Magento 2 Change Default OrderBy Parameter for Search Results

Try a below code. Tested in M2.3. This will change the sorting option from Relevance to Price only for Search Result Page. You can change the $defaultSortBy and $directionToSet as per your need. ...
user avatar
  • 3,582
9 votes
Accepted

Magento 2: How to remove "Did you mean" section from search page?

https://docs.magento.com/user-guide/catalog/search-configuration.html#general-search-options You can disable(select no) following both the options, from System Configuration -> Catalog -> ...
user avatar
  • 1,745
8 votes
Accepted

Show layered navigation on catalog search results page in magento

It may depends of the number of results. Open the search settings at admin - system - configurations - catalog - catalog search and find the option "Apply Layered Navigation if Search Results are ...
user avatar
  • 6,500
8 votes

How to get Search Result Count in head.phtml

Please try bellow code if($listBlock = $this->getLayout()->getBlock('search_result_list')) { $productCollection = $listBlock->getLoadedProductCollection(); echo $productCollection-&...
user avatar
  • 9,522
7 votes
Accepted

Custom image attribute is not displayed on search list

Make sure the hover_image attribute is marked as 'Used in product listing'. Unfortunately, for some reason still unknown to me, you cannot set that flag for media attributes from the backend. But you ...
user avatar
  • 195k
7 votes
Accepted

How to get Search result Product collection outside result.phtml

Never mind I found a solution and it got work $term = Mage::helper('catalogsearch')->getQueryText(); $query = Mage::getModel('catalogsearch/query')->setQueryText($term)->prepare(); $...
user avatar
7 votes
Accepted

URL Redirect from Catalog Search to Category Page

Magento has that ability built in, though it must be managed. If you go to Catalog -> Search Terms, you can enter the search query you want to redirect, and the destination URL for the redirect.
user avatar
  • 1,334
7 votes
Accepted

Magento2; Advanced Searching (SmartSearch)

To perform full text search Magento\Framework\Api\Search\SearchInterface should be used. Please note that Service Contracts concept was introduced in Magento 2, even though Service API is available ...
user avatar
7 votes
Accepted

How can I add meta noindex to all catalog search result pages in Magento2?

To me you can simply create the following files in your module: view/frontend/layout/catalogsearch_advanced_result.xml view/frontend/layout/catalogsearch_result_index.xml In case of a theme, the ...
user avatar
7 votes

Magento 2: How to use ElasticSearch?

We have been using https://github.com/Smile-SA/elasticsuite with some good success. It does come with some other functionality as well as search but it's well maintained.
user avatar
  • 1,666
6 votes
Accepted

Searching for SKU without special characters

To make this work for both, the real SKU and the one without -, both have to be added to catalogsearch_result table because SQL-query for search results looks like this: SELECT `s`.`product_id`, 0 AS ...
user avatar
  • 11.5k
6 votes

How do I change Magento 2 search from OR logic to AND?

I found the solution , create a file search_request.xml in your module's etc folder , copy the entire node from vendor/Magento/CatalogSearch/etc/search_request.xml and change <queryReference ...
user avatar
  • 191
6 votes
Accepted

I faced the error while search any string Magento 2

Please check this query : SELECT search_synonyms.* FROM search_synonyms WHERE (MATCH (synonyms) AGAINST ('9898' IN BOOLEAN MODE)) And give the query in database table search_synonyms ALTER TABLE ...
user avatar
  • 1,481
5 votes
Accepted

Magento search return only products containing both words

In the method Mage_CatalogSearch_Model_Resource_Fulltext::prepareResult there is this code that splits the query string into words and generates a where condition, but it works only in like or combine ...
user avatar
  • 195k
5 votes

Search does not return results

I've experienced this. My fix was to go to Manage Products and select all products and perform an "Update Attributes" from the dropdown above the grid. In the Update Attributes screen, move to the ...
user avatar
5 votes

Catalog Search looking at descriptions = returning irrelevant search results

I too faced the same problem before. This is because by default "description" attribute is set to Searchable. Solution: Login to Magento Admin Panel. Goto Catalog > Attributes > Manage Attributes ...
user avatar
  • 218
5 votes
Accepted

Manually specifying top search results for a specific search query

A wild idea. Not sure if it will work, but you can give it a try. It's simple and not very time consuming. The search works like this. The attributes you marked as searchable are indexed in the table. ...
user avatar
  • 195k
5 votes

Manually specifying top search results for a specific search query

You could create a new text area attribute "search_boost", make it not visible in the frontend but searchable and use it to add search terms where this product should show up. With the default ...
user avatar
5 votes

Include category in search result

Interesting question, hence upvoting it. Below is the code for achieving the categories and the corresponding products as results. I have planned to reuse the FILTERS (Layered Navigation) concept to ...
user avatar
  • 521
5 votes

Magento 2: what is the search_request.xml file used for?

Looks like it's used to define attributes certain filters should be applied to and then searchable attributes are applied against this XML to configure the searchRequest - see: Magento\CatalogSearch\...
user avatar
5 votes
Accepted

Adding new page to Front end

Problem resides in your layout update xml file, particularly in the following block declaration. <block type="abc_helloworld/index" name="helloworld_any_block" template="helloworld/index.phtml" /&...
user avatar
5 votes

How to enable or add layered navigation to search result page in Magento 2

It's tied to the attribute settings: If you need show layered navigation for some attribute then please enable it in backend. Go to stores > attributes > product, find and open needed attribute ...
user avatar
  • 708
5 votes
Accepted

Magento 2 - Plugin issue in catalogsearch

Thanks to @fschmengler and reading Magento 2: virtual types plugins I solved using this app/code/vendorName/moduleName/etc/di.xml: <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/...
user avatar
  • 1,491
5 votes

Magento 2.x CatalogSearch Undefined Variable($resultPage)

Try adding this to the beggining of your execute method $resultPage = $this->resultFactory->create(ResultFactory::TYPE_PAGE); I would also set the visibility of your variable in the class but ...
user avatar

Only top scored, non community-wiki answers of a minimum length are eligible