Search Autocomplete - Product Tags Setting

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
3 years ago
Hello,
Running nopCommerce 4.3

Catalog Settings -> Search and Search Autocomplete options enabled. Search results are only returning list of products that contain search key words in product title.

Where is the setting to enable searching Product Tags?
3 years ago
I think that, out of the box, the only time Tags are searched is if the customer selects "Search In product descriptions" at the bottom of the public advanced search page.

You may be able to modify the SQL Stored Procedure [ProductLoadAllPaged] to change the behavior.
3 years ago
Thats what I thought too. Was reluctant to touch the Stored Procedure. These days, quick Search tweaks are crutial. Searching in Product Description is not practical at all, because if you have few thousand items in your catalog, the search is soooo slooow. Allowing Product Tags search is the most practical function for quick adjustment.
3 years ago
searchProductTags property defaults to false in ProductService: https://github.com/nopSolutions/nopCommerce/blob/6195c569d2f977880879c2dc46e1b16f13387b9c/src/Libraries/Nop.Services/Catalog/ProductService.cs#L673

You can override that method, or the SearchTermAutoComplete method in CatalogController from where it's called, and then recompile and deploy.  Or as New York suggests, a quick edit to the stored procedure accomplishes the same without needing to touch the code.

Setting the default will set it to true if the value is not passed from the caller (around line 26):
@SearchProductTags  bit = 1, --a value indicating whether to search by a specified "keyword" in product tags


But since the caller most likely defaults to false in most cases you can set it to true in the SQL absolutely (place it near the other SETs around line 58):
SET @SearchProductTags  = 1


or based on some other conditions (like whether @SearchDescriptions = 1)

IF @SearchDescriptions = 1
    SET @SearchProductTags  = 1


Then the SQL for productTags should run as expected.

Looks like they're moving away from the stored procedure in 4.4 so it may be more convenient long-term to just override it in the code and merge your changes when upgrading.
3 years ago
Thank you for this tip. This totally worked!!! Search now goes through Product Tags and produces proper search results, and it did not affect the performance, everything is relatively fast.

Hopefully Search Tags option is included out of the box in 4.4

Anyways, thanks for your help. Much appreciated.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.