-
Notifications
You must be signed in to change notification settings - Fork 340
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom Category Attribute > Use in Search popup and Search Result #3427
Comments
Hi @mahesh-makwana-web-vision : the Search Result page is designed to display only products, so you'll not be able to get categories here easily. But on the autocompletion box, you can easily have category results if you create your category attribute with "is_searchable=1" in your setup script. This will tell the search engine to index it and to use it when building search results. Regards |
Hello @romainruaud So, basically, I need to create a new custom category attribute with the value "is_searchable=1," and that's it. No other file changes are required, right? Am I correct, or are there any additional steps needed? Thanks |
Yep, that's it. And after that, you run a full reindex of the "Elasticsuite Categories fulltext" indexer. Regards |
Let me check and update you. |
Yes @romainruaud, The search works when a category custom attribute with "is_searchable=1" is added. Now, we have a requirement: when typing a product name, we want the category containing that product to appear in the search results. Currently, only the product is showing, but not the associated category. Is there a way to achieve this? We planned to use a custom attribute to store all product names in a single field and make it searchable. However, this approach may create issues with synchronization when products are added or updated, as the product names would need to be kept in sync. Do you have any suggestions for a more efficient solution? cc: @vahonc Thanks. |
Hello @romainruaud We created an indexer and stored the product name and SKU in that field. After reindexing, the related categories are not showing in the search results. Can you please help us? Thanks. |
HI @mahesh-makwana-web-vision we do not provide support for custom development here. Best regards |
Hello @romainruaud and @vahonc Below is the code for our custom attribute:
We’ve added the attribute to the Category page using the following form:
OUTPUT Category Page: Debug Log:
ISSUE: The content is visible on the Category page and is indexed, but when we perform a search, the related categories are not appear in the search results. We are using Magento 2.4.7-p2 with ElasticSuite 2.11.9 on Elasticsearch 8.15.3. We’ve implemented the is_searchable=1 attribute as per your prior confirmation, but we’re still facing issues. Could you please help us troubleshoot this? Thank you. |
@mahesh-makwana-web-vision if you are willing to display Categories on the search result page, you'll have to implement this yourself :
|
When we search by SKU or product name, we want the related category to appear in the search results. Currently, if the search string matches, only the category name is displayed. To address this, I added a custom attribute to the category and stored all product names and SKUs within this attribute. I also set this custom field to is_searchable=1, but the category name still doesn’t appear based on the custom attribute value. I’ve added the code that was previously shared. Could you please guide me on where I might be going wrong? Thanks. |
Hi, I've explained what you should try to do. You can take inspiration from this module : https://github.com/Smile-SA/magento2-module-elasticsuite-cms-search Just replace the frontend part which is fetching "PageCollection" with a "CategoryCollection" and you should be all good. Best regards |
Okay @romainruaud Let me check and update you. Thanks. |
Hello @romainruaud I attempted to change the CMS page collection to a category collection, but it’s not as straightforward as it seems. The module currently functions based on a single table for CMS pages and CMS stores. However, category data comes from different tables, and modifying the Elasticsearch-related files is necessary. This makes the implementation more time-consuming and complex. If you have any sample code available for implementing category custom attributes, I’d be happy to review it. Thanks. |
Is there a way to use custom category attributes in the search popup and search page, similar to how they are used for products?
I found this file, but I'm not sure how to modify it to include a custom attribute.
Path:
Smile\ElasticsuiteCatalog\Model\ResourceModel\Category\Indexer\Fulltext\Action\Full
Can you please help me make categories searchable by their custom attribute?
The custom attribute is of the text datatype.
cc: @romainruaud @vahonc
Thanks.
The text was updated successfully, but these errors were encountered: