magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.48k stars 9.29k forks source link

Currently facing issue in catalog search using search with SKU keyword #31466

Open sw-tt-jigneshvagh opened 3 years ago

sw-tt-jigneshvagh commented 3 years ago

Preconditions (*)

  1. I am usng magento 2.4.0 version

  2. I am using magento-cloud started plan

  3. Reproducible on clean 2.4-develop

    Steps to reproduce (*)

  4. In Products, I have "170000D000237" SKU named product, but when I will search from Frontend Area from topsearch with some SKU keywords like "D000237" its giving "Your search returned no results." message (not return data). but from first letters like "170000" its giving me proper data. So please tell me what i am doing wrong here.

  5. In same case other product I have like "C-09700-QSJA2" its also behave as above I mentioned.

Expected result (*)

  1. In above two case I mentioned it will give me not found result, but it should be give me the result data in all cases which keywords I will search with from SKU, Name from it I will type from last charactor or between-to-last charactors in it.

Actual result (*)

  1. Found Data returned-data

  2. Not Found Data not-return-data-2 not-return-data-1

    Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.

m2-assistant[bot] commented 3 years ago

Hi @sw-tt-jigneshvagh. Thank you for your report. To help us process this issue please make sure that you provided the following information:

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

@magento give me 2.4-develop instance - upcoming 2.4.x release

For more details, please, review the Magento Contributor Assistant documentation.

Please, add a comment to assign the issue: @magento I am working on this


:clock10: You can find the schedule on the Magento Community Calendar page.

:telephone_receiver: The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, please join the Community Contributions Triage session to discuss the appropriate ticket.

:movie_camera: You can find the recording of the previous Community Contributions Triage on the Magento Youtube Channel

:pencil2: Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel

m2-assistant[bot] commented 3 years ago

Hi @engcom-Bravo. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

engcom-Bravo commented 3 years ago

Hello @sw-tt-jigneshvagh

Thank you for your report.

The issue is reproducible on clean 2.4-develop using quick search quick_search

magento-engcom-team commented 3 years ago

:white_check_mark: Confirmed by @engcom-Bravo Thank you for verifying the issue. Based on the provided information internal tickets MC-40245 were created

Issue Available: @engcom-Bravo, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

magento-engcom-team commented 3 years ago

:white_check_mark: Confirmed by @engcom-Bravo Thank you for verifying the issue. Based on the provided information internal tickets MC-40245 were created

Issue Available: @engcom-Bravo, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

magento-engcom-team commented 3 years ago

:white_check_mark: Confirmed by @engcom-Bravo Thank you for verifying the issue. Based on the provided information internal tickets MC-40245 were created

Issue Available: @engcom-Bravo, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

sw-tt-jigneshvagh commented 3 years ago

any updates on this ? @engcom-Bravo @magento

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 14 days if no further activity occurs. Is this issue still relevant? If so, what is blocking it? Is there anything you can do to help move it forward? Thank you for your contributions!

johebting commented 3 years ago

any updates on this ?

gowrizrh commented 2 years ago

@johebting @sw-tt-jigneshvagh I'm not sure why this is confirmed as an issue by the Magento team but

From the looks of it, this is the way the Elasticsearch module for Magento works.

In the catalog search module there's an explicit Elasticsearch analyzer defined to search on prefixes.

<!-- vendor/magento/module-catalog-search/etc/di.xml:276 -->

<type name="Magento\CatalogSearch\Model\Search\Request\MatchQueriesModifier">
    <arguments>
        <argument name="queries" xsi:type="array">
            <item name="partial_search" xsi:type="array">
                <item name="name" xsi:type="array">
                    <item name="analyzer" xsi:type="string">prefix_search</item>
                </item>
                <item name="sku" xsi:type="array">
                    <item name="analyzer" xsi:type="string">sku_prefix_search</item>
                </item>
            </item>
        </argument>
    </arguments>
</type>

I'm using the sample data to search for the product SKU WH01

Searching WH0 will return search results

image

Searching H01 will return nothing

image

If you simply take the raw request that Magento performs on the product index in Magento, you can see the prefix clause there. image

Note that you can perform wildcard queries on document fields in Elasticsearch but that is not to be confused with the prefix analyzer defined in Magento.

Example: You can construct queries that could use wildcards image

In conclusion this is not an issue.

johebting commented 2 years ago

This may not be a technical problem since the behavior matches the ES query, but you can't just assume that this behavior matches a product reference search.

In my opinion, this search should work regardless of how the catalog and SKUs are constructed.

If for some reason the catalog is built with SKUs following this pattern: {color}-{size}-{parent_reference} , how can anyone expect to get relevant search results if Magento or ES only search in the prefix?

Maybe Magento can keep this behavior, even as the default one, but propose others via a new configuration of the search modules.

gowrizrh commented 2 years ago

The search isn't only in the prefix. The prefix is an additional match on all the existing rules.

Personally I don't see a case where a customer or a system would search partially by SKUs given every other attribute is also indexed.

The prefix is mostly a convenience feature and it is up to Magento to decide if this is a feature that should be supported in future.

engcom-Bravo commented 2 months ago

@magento give me 2.4-develop instance

magento-deployment-service[bot] commented 2 months ago

Hi @engcom-Bravo. Thank you for your request. I'm working on Magento instance for you.

magento-deployment-service[bot] commented 2 months ago

Hi @engcom-Bravo, here is your Magento Instance: https://4d941d02ed3000be9f94204572cf97f6.instances-prod.magento-community.engineering Admin access: https://4d941d02ed3000be9f94204572cf97f6.instances-prod.magento-community.engineering/admin_73c9 Login: 2b3a2a4c Password: c0e780f0b917

engcom-Bravo commented 2 months ago

Hi @sw-tt-jigneshvagh,

Thanks for your reporting and collaboration.

We have verified the issue and it seems to be an expected behaviour of magento.Hence we are considering this as a improvement and we are considering this as feature request.

Thanks.