Skip to content
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

not able to use SKU in search #361

Closed
sumitgithub opened this issue Mar 21, 2017 · 8 comments
Closed

not able to use SKU in search #361

sumitgithub opened this issue Mar 21, 2017 · 8 comments

Comments

@sumitgithub
Copy link

I want to use SKU attribute in search so user can search through single SKU.

@afoucret
Copy link
Contributor

This issue duplicates #100 and have been fixed by PR #300
It has been merged in branch 2.4.x and will be part of the next major release (2.4.0).

@wardcapp
Copy link

wardcapp commented Apr 6, 2017

@afoucret: first of all thank you for the fast reply! But after trying branch 2.4.x of the module (which includes PR #300, our fork was based on commit 09519ab) on our local Magento 2 environment, we were still not able to get the SKU based search working. When executing a direct fuzzy query on the Elasticsearch node the expected results are returned, but for some or other reason the module still is not.

An example of a SKU that we are using to test the frontend / module search with:
RS-25-48

But maybe we are missing some kind of required configuration to get the SKU search working? Or did we try the 2.4.x branch too soon / are we missing some other changes?

@southerncomputer
Copy link
Contributor

southerncomputer commented Apr 8, 2017

patch the analyzers.xml

</filter> <filter name="reference_delimiter" type="word_delimiter" language="default"> <generate_word_parts>0</generate_word_parts> <catenate_words>0</catenate_words> <catenate_numbers>0</catenate_numbers> <catenate_all>0</catenate_all> <split_on_case_change>0</split_on_case_change> <split_on_numerics>0</split_on_numerics> <preserve_original>1</preserve_original> </filter> <filter name="shingle" type="shingle" language="default">

and then

</analyzer> <analyzer name="reference" tokenizer="whitespace" language="default"> <filters> <filter ref="reference_delimiter" /> <filter ref="lowercase" /> <filter ref="ascii_folding" /> <filter ref="trim" /> <filter ref="edge_ngram_front" /> </filters> <char_filters> <char_filter ref="html_strip" /> </char_filters> </analyzer> </analyzers>

and then change the sku field in indices from whitespace to reference:
<field name="sku" type="string"> <isSearchable>1</isSearchable> <defaultSearchAnalyzer>reference</defaultSearchAnalyzer> </field>

@wardcapp
Copy link

@southerncomputer: just took the time to test the patch you proposed and it did fix our SKU search, thank you for the quick and valid response!

In case others would like to apply the same patch, here is the commit (which is compatible with the current 2.4.x branch of the project):
studioemma@2ac9f8e

@wardcapp
Copy link

A quick update on this - looks like we are still having some issues on the exact SKU search queries.

After some further testing, we are experiencing the very same issue (some SKU's do give valid results, while others end up returning strange matches). The commit I created before does not address the SKU search problem completely.

Maybe someone else might have a closing solution or an upcoming release fixing the issue could be confirmed?
Thanks in advance!

@wardcapp
Copy link

In case others might stumble upon this ticket - duplicate and newer issue is #412.

@madonzy
Copy link

madonzy commented Oct 17, 2017

@southerncomputer your solution works, but it searches only by full SKU, is it possible to make it work like: "FF-32" and it'll find products with SKU: "FF-32123", "FF-32435", "GBFF-32123"?

@flexsingit
Copy link

@madonzy I am facing the same issue.

when we search with the ISD-TN450 it is returning the correct results i.e 3 products but when we search with the ISD-TN45 it is not returning any result.

We have checked the demo at http://demo.magento-elastic-suite.io/ and search with the keyword WT09 it is returning the exact result but when we search with the keyword WT0 it is not showing any result. but the product exists and showing on the website. Please suggest if we are missing something in our configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants