Magento 2 upgrade has brought in certain improvements to Magento. Site search is a very important feature for any e-commerce store and Magento search has always been one of Magento’s weak point. In this article, we will see whether
Magento 2 offers
- Significantly improved scalability.
- Faster page loading speed- Full-page caching has been built in Magento 2 which helps in faster speeds by reducing the number of disk reads and network round-trips.
- A number of new marketing and analytics tools for Magento store owners to help them sell better.
- A much simpler up-gradation process.
- HTML5 and a revised CSS pre-processor.
- All needed features to set up an e-commerce store in a short period of time.
Catalog search optimization is absolutely mandatory for Magento stores since website visitors who search are twice more likely to purchase than site visitors who don’t. So it is important that your Magento catalog search is optimized.
The Search box in the header of the store helps visitors find products in your catalog. The search text can be the full or partial product name or any other word or phrase that describes the product. The search terms that people use to find products can be managed from the Admin.
To do a quick search
- In the Search box, on the top right-hand corner of your home page, customers can enter a few letters to find products that match against the product catalog. This is also known as autocomplete. ( Magento also shows that number of products matching in the catalog).
- Customers can either press the Enter key or tap a result in the list of matching products.
Advanced search lets your website visitors search your catalog by entering multiple fields into the search form such as
- Short description
- Tax class.
Each of these fields is an attribute of your product. You can customize this search by including only relevant fields that you think will be useful for the site visitors.
To use the advanced search
- In the footer section of your Magento store, click on Advanced Search.
- Enter fields in the advanced search and click on search to get the search results.
- You can modify search parameters if you can’t find the search results you are looking for.
Search results or the search results page contains all the products that match the search query entered into the search box. The results are shown as a grid or list which can be sorted by price or relevance. Pagination numbers are also present at the bottom of the page which can help to take users to the next pages in search results.
Search weights help in changing your search results ranking by assigning individual weights to product attributes. In Magento 2, you can give weights to product attributes so that search results will change accordingly. For example, you can give more weight to the color of the product compared to the description of the product if more people are making color based searches on your website.
To set the search weights of an attribute-
- Login to your admin panel.
- From the admin sidebar, go to stores-> attribues-> product.
- Click on the attribute and click on edit.
- Choose storefront properties
- Set Use in search to “yes”.
- Set search weight from (1-10). 10 is the highest priority.
- Click on save.
Configuring Catalog Search
Magento supports both MySQL and elastic search.
MySQL is the default search engine used by Magento.
MySQL is the default search engine. By adjusting the Catalog Search configuration, you can control the behavior of the search operations and determine the size of valid query text and the display of search recommendations.
How to configure Magento 2 MySQL search
- From the admin sidebar, go to stores-> settings-> configuration
- From the left panel, choose catalog.
- Expand the catalog search.
- Go to stores-> settings-> configuration
- in the left panel, Choose catalog.
- Expand the catalog section.
- You can see that the search engine is set to MySQL.
- You can set the minimum and maximum query length.
- By default, the Search Engine is set to “MySQL”. If switching to MySQL, select that option. This affects the available fields.
- To limit the length and word count of search query text, set the Minimal Query Length and Maximum Query Length.
- Set the number of top search results to cache (default is 100. Entering 0 (zero) caches all search terms.
- Autocomplete limit The lower this number is, the faster the search performance is. The default amount is 8.
- You can enable search suggestions to “yes” or disable if not needed.
- To offer search recommendations, set Enable Search Recommendations to “Yes.”
- Click on save config.
Elasticsearch is a powerful search engine that powers search on many traffic-heavy websites.
Here are steps to configure elastic search
Step 1: Configure Search Options
- Go to the admin sidebar-> stores-> Settings-> Configuration.
- On the left panel, under catalog, choose catalog
- Expand the catalog search section.
- Set the minimal query and maximum query length.
- Under the Search Engine field, choose the version of elasticsearch installed on your server. (deselect use system value)
- Elasticsearch (Deprecated) — Elasticsearch 2.0+ that has been shutdown.
- Elasticsearch 5.0+
- Elasticsearch 6.0+
- For Enable EAV Indexer, you can set it to be enabled. This improved indexing speed and prevents 3rd party extensions from using the indexer.
- If you would like to speed up the search speed, you can limit the number of top search results to cache to lower values for faster responses. The default is 100. Entering a value of 0 caches all search terms and results when entered a second time.
- Autocomplete Limit- Under autocomplete limit, deselect ” Use system value” and set a value. The lower the value you set here, the faster your search performance is.
Step 2: Configure the Elasticsearch Connection
- Enter the Elasticsearch Server Hostname.
- Enter the Elasticsearch Server Port.
- In the Elasticsearch Index Prefix field, enter a prefix.to identify the Elasticsearch index.
- Set Enable Elasticsearch HTTP Auth to “Yes” or no.
- In the Elasticsearch Server Timeout field, enter the number of seconds before the system times out. The default value is 15.
- Once the values are entered, click on Test connection to test your settings.
Step 3: Configure Search suggestions and Recommendations
Search suggestions and recommendations can impact server performance.
- Set Enable Search Suggestions to “Yes”. (if you would like to enable search suggestions).
- Search Suggestions Count – Here enter the number of search suggestions to display when a search query is made.
- Show results count for each suggestion- This option if enabled displays the number of items at the side of every search suggestion.
- To display search recommendations, set Enable Search Recommendations to “Yes”.
- In the Search Recommendation Count field, enter the number of recommendations to offer.
- If you would like to show the number of results found for each recommendation, set Show Results Count for Each Recommendation to “Yes”.
- When complete, click on save config
Here is an explanation of the search fields.
|Minimal Query Length||Store View||The minimum number of characters allowed in a catalog search. For example, when you set the minimal query length to 2, search results will appear only after the user enter 2 letters in the search box.|
|Maximum Query Length||Store View||The maximum number of characters allowed in a catalog search.|
|Number of top search results to cache||Store View||The number of popular search terms and results to cache for faster responses. Since popular search terms are entered by all users again and again on your store, caching them might help in increasing search speed. Value of 0 caches all search results. The default value is 100.|
|Autocomplete Limit||Store View||The maximum number of search results to display for search autocomplete. The default value is 8.|
|Enable Search Suggestions||Store View||Search suggestions appear when the search box returns no results.|
|Search Suggestions Count||Store View||The maximum number of search suggestions offered for search queries. The default value is 2.|
|Show Results Count for Each Suggestion||Store View||Enables or disables the number of search results shown for each suggestion.|
|Enable Search Recommendations||Store View||Choose whether to show search recommendations or not when a search query returns zero results.|
|Search Recommendations Count||Store View||Determines the number of search terms offered as recommendations. The default value is 5.|
|Show Results Count for Each Recommendation||Store View||When set to “Yes”, the number of products found for a given search query are shown beside the search recommendations|
Search terms give great insights into what people are searching on your Magento 2 store. You can get an idea on what to stock more or find out gaps in product demand. You can also redirect customers to other pages for search queries that don’t have direct product name matches.
To view search terms,
- Log in to your Magento 2 admin panel.
- Navigate to Marketing-> Search terms.
The landing page for a search term can be one of the following.
- Content page.
- Category page.
- Product page.
- Page on a different site.
- Check out page.
- Refund page.
Adding synonyms to Magento 2 is an easy way to direct users searching for products using search queries that don’t match their name in the catalog.
For example, if users are searching for “Apple laptop” and the product is listed as MacBook in your catalog, you can add MacBook as a synonym for Apple laptop
To add synonyms in Magento 2,
- Go to admin panel-> marketing-> Search synonyms.
- Click on the new synonym group button.
- Select the scope.
- Enter your list of synonyms separated by a comma.
- Click on Save synonym group.
The search terms report will give insights into spelling errors made by your customers. You can add redirects to such search terms and send them to the correct page or product using the synonyms feature.
Popular Search Terms in Magento 2
The most popular search terms on your Magento 2 store are displayed at the footer in the form of a tag cloud where the size of a search term indicates its popularity.
There is also a popular search terms page which can be accessed at yourstore.com/search/term/popular
How to configure Popular Search Terms in Magento 2
- Go to stores-> settings-> configuration
- In the left panel, under catalog, choose catalog.
- Click on Search Engine Optimization section.
- Under Popular Search Terms, uncheck use system value as needed.
- Click on save config.
Adding Search Terms- Magento 2
As you learn new words that people use to search for products in your catalog, you can add them to your search terms list to direct people to the most closely matching products in your catalog.
To add a new search term
- Go to marketing-> SEO & Search-> choose search terms.
- Click on Add new search Term.
- Under General Information
- In the Search Query box, enter the search query
- Choose a store.
- Enter a redirect URL if needed.
- If needed, set display in suggested terms to Yes
- Click on save search
To edit a search term in Magento 2
- In the Search Terms grid, click the row of the search term report in edit mode.
- Make the necessary changes.
- Click on save.
To delete a search term
- In the list, mark the checkbox of the term to be deleted.
- In the upper-left corner of the list, set Actions to “Delete”.
- When complete, tap Submit.
Search Terms Report- Magento 2.
The Search Terms report shows the
- The number of results for each term,
- The number of times (hits) the term was used.
The report data can be filtered by term, store, results, and hits, and exported for further analysis.
How to view the search terms report in Magento 2
- On the Admin sidebar, Go to reports-> Marketing-> search terms
- Use the controls to filter the report as needed.