Skip to content

Add The Ability To Limit Autocomplete Results #11572

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

Merged

Conversation

mpchadwick
Copy link
Contributor

@mpchadwick mpchadwick commented Oct 20, 2017

Description

Adds the ability to limit the number of results in the search autocomplete. Defaults to 8

image

Manual testing scenarios

  1. In the admin create a product called "Elephantawesomepants"
  2. On the frontend search for "Ele", "Elep", "Eleph", etc... until you've passed the default limit
  3. Notice that no more than the configured limit of search terms are displayed

Contribution checklist

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds on Travis CI are green)

@mpchadwick mpchadwick changed the title Feature/autocomplete limit Add The Ability To Limit Autocomplete Results Oct 20, 2017
@vrann vrann self-assigned this Oct 20, 2017
@vrann vrann added this to the October 2017 milestone Oct 20, 2017
@vrann vrann added the develop label Oct 20, 2017
@magento-engcom-team magento-engcom-team changed the base branch from develop to 2.3-develop October 20, 2017 15:32
@vrann
Copy link
Contributor

vrann commented Oct 24, 2017

@mpchadwick Note from our QA:

It looks like something is broken after this fix.

I have these products: catalog_product_20171024_082043.csv.zip

image1

When I try to find 'ele' my autocomplete shows me that there are 10 products that match my search expression. We can type one mode letter and still should expect that there are 10 products that match my search expression, but autocomplete is not shown.
image2

And what is really weird is what we see on 2.3-develop:
image3

@mpchadwick
Copy link
Contributor Author

@vrann

I'm not sure that your QA understands how the search autocomplete functions. The search autocomplete shows suggestions by finding previously run queries that contain the string that the user entered. If a user previously searched "ele" and re-types "ele", "ele" will show in the search autocomplete. If the user types "elep" but a search for "elep" has never happened before it will not show "elep" in the search autocomplete. If that user executes the search for "elep" the next time someone types "elep" into the search bar, it will show as an autocomplete suggestion.

Regarding the screenshot you shared from the admin panel, my change is not targeted at the search feature in the admin panel (in 4 years of working with Magento I don't think I've used that once). I was able to reproduce the red error message from the screenshot...however it was not introduced by my code an I could reproduce it after reverting my changes. The following reproduces reliably for me every time...

  1. Import the product set provided (catalog_product_20171024_082043.csv.zip)
  2. Type "elep" into the search field in the admin panel
  3. Delete "elep" and unfocus the form field

You will get the error at this point

@vrann
Copy link
Contributor

vrann commented Oct 25, 2017

@mpchadwick got it, makes sense. Thank you for the explanation!

@magento-engcom-team
Copy link
Contributor

@mpchadwick thank you for contributing. Please accept Community Contributors team invitation here to gain extended permissions for this repository.

@okorshenko
Copy link
Contributor

Hi @mpchadwick
Could you please resolve code conflicts so that we can proceed with the PR acceptance?

@mpchadwick
Copy link
Contributor Author

@okorshenko done

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

Successfully merging this pull request may close these issues.

6 participants