Coder Social home page Coder Social logo

Comments (9)

jreinke avatar jreinke commented on September 13, 2024

Thanks for your feedback.

Indeed, this part of code could be optimized to keep only interesting fields. This is something you can already do by observing the event bubble_autocomplete_product_collection_init. Then, you'll be able to customize the collection.
Also, you can disable local storage from Magento Admin if you have a too large catalog.

from magento-autocomplete.

riker09 avatar riker09 commented on September 13, 2024

I don't think disabling local storage results in large benefits. After all, the local storage acts as a cache and prevents that the product json data is pulled from the server on each request! I cannot think of a reason to not having this option enabled.

from magento-autocomplete.

Flyingmana avatar Flyingmana commented on September 13, 2024

I think it would make sense to only use searchable atributes + some default ones, this would reduce the amount already strongly and gives others over this or another event a way to add additional ones?

from magento-autocomplete.

Chris25602 avatar Chris25602 commented on September 13, 2024

Glad this thread is here...my store has 100k+ products. Thanks for watching out.

from magento-autocomplete.

winkelsdorf avatar winkelsdorf commented on September 13, 2024

@Flyingmana 👍 Agreed, probably best to initially fetch only

name, thumbnail, url_path, type_id, min_price, final_price, price

At least that's what is currently used by js.phtml.

I'd been testing this but for some reason I'd been unable to filter the getCollection() call.

from magento-autocomplete.

winkelsdorf avatar winkelsdorf commented on September 13, 2024

Better idea: Probably best to split this into two json queries. One for e.g. the 100 newest or best selling products and one dynamic query which sends the search term via ajax to the backend and returns a limited live result json (5 hits, 10 hits as defined in the backend).

The queries can also be cached if wanted. Drawback: Either the cache might grow depending on the amount of used search terms (= jsons returned) or the live db queries might result in heavy db server load until db is cached/flat product category is used.

@Chris25602 But anyway, sounds better than delivering 100k+ products json with each 1st visit of the page or if the cache ttl is reached.

What do the others think? I believe with a limit of e.g. 5 products the queries and returned jsons are very small and fast..

Edit: What I mean can be seen here:
https://twitter.github.io/typeahead.js/examples/#remote

Edit2: Together with the remote debounced ajax request already implemented in Bloodhound this should lower the requests and db queries a lot (for difference between debounce/throttle see example at http://benalman.com/code/projects/jquery-throttle-debounce/examples/debounce/).

from magento-autocomplete.

winkelsdorf avatar winkelsdorf commented on September 13, 2024

I implemented the suggetions I made in winkelsdorf@f6b4df8

Feel free to test and report your experiences. As of now the magento caching is not used at all anymore. Twitter's Typeahead & Bloodhound already provides a debounce/throttling and rateLimitWait to wait with ajax requests (default 300ms).

Integrating a correct caching would require a lot more work than before: Cache the prefetched Product List, Invalidate on Product changes, probably cache the smaller ajax requests and invalidate all of them on demand. I don't see how this can be easily implemented with what magento provides..

@Chris25602 Curious how this extension would perform on your store now! As the searches always fetch a limited amount of rows (one prefetch limit, default 100 - and one for ajax live search defaulting to 5) this should be no issue anymore to run this on a store with 10k or even 100k+ products.

Just the db load with many concurrent users should be something that probably needs observation and a reimplementation of a caching mechanism (magento, varnish).

Cheers,
Frederik

from magento-autocomplete.

winkelsdorf avatar winkelsdorf commented on September 13, 2024

@riker09 Initial proposal to include a reduced attribute set finished: winkelsdorf@ce312f3

from magento-autocomplete.

Chris25602 avatar Chris25602 commented on September 13, 2024

@winkelsdorf Hello I haven't had a chance to jump back in here for a while but, testing this is next up whenever I have a slowday and I will be sure to come back and let you know how it goes /tldr --TODO

from magento-autocomplete.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.