search_query table in Magento 2 stores the queries searched by users through the search box in the Magento 2 store.
These search queries are used to show the search suggestions for new customers based on what the previous customers have searched. Also, the popular search terms are shown on the admin panel dashboard for the admin to analyze and understand the demands and popularity of the products.
If the search_query table is cleared out, the new customers won’t be suggested any search suggestions until new entries are populated in the table again. If you are using custom search solutions you can just truncate it.
Fields in search_query Table In Magento 2:
- query_text – It stores the value of the search string. When a user performs a search using the search box in the Magento 2 store, that string is added in the query_text field in the search_query table as a new entry.
- num_results – It stores the number of string search in a store. This field is used to display “Number of results”
- popularity – It shows the popularity of specific words in your store. This field is used to display “Number of uses”
- store_id – It shows the search from a specific store.
The values from these fields of the database are displayed in the admin panel under Marketing > SEO & Search > Search Terms as shown below:
That’s all for the search_query table in Magento 2.
Do share the post with the Magento community via social media.
Thank you.