I wanted to make the searches faster & more relevant for my woocommerce site, so I made a custom endpoint which returns all the published/instock products + their titles/thumbnail/price/slug. Then I’ll fetch that endpoint whenever the user opens the search and use a library like flexsearch.js to make an index & search it. Using flexsearch means the results are instant & you can adjust for relevancy/context + include filters on fields which I really wanted.
Using the wp rest cache plugin, for 500 products the response time is 50-75ms. Thats pretty reasonable, and the indexing on the client with flexsearch is negligible. I don’t expect this to scale to 100k products but it’s pretty good & no need to set up a search service.
Has anyone done something similar, or would this be a useful plugin?
[ad_2]