Hey everyone! I'm creating a search system for an e-commerce platform and could really use some advice. I'm still learning, so please bear with me. Here's what I'm working on:
I want to integrate Elasticsearch for searching products and Redis for caching those results to speed things up. My goal is to implement a Weighted Round Robin (WRR) system that balances exposure between sponsored products (paid) and non-sponsored ones (regular listings). Here's how I plan to set it up:
- I want to show 70 products per page, out of which 15 will be sponsored from different Elasticsearch indices and the rest will be non-sponsored.
- I intend to create separate WRR pools for sponsored and non-sponsored products to manage their display.
For calculating weights to prioritize products, I'm taking into account product reviews, total sales, and seller feedback. My weight calculation formula looks like this:
Weight = 0.5 * (1 + log(productPositiveFeedback)) + 0.3 * (1 + log(totalProductSell)) + 0.2 * (1 + log(sellerFeedback))
To keep things balanced and allow newer sellers to compete, I'm capping the weight. For example, if the weight exceeds 10, it's counted as 11, and weights over 100 get capped too.
I also have several questions:
1. Does my weight calculation and capping approach sound reasonable?
2. Is my Redis and Elasticsearch setup effective? How many products should I cache in Redis to avoid overloading it?
3. Will my weight calculation interfere with how products are displayed within categories?
4. Could a search for "GTA" pull products that shouldn't be prioritized since they come from a "GTA 5" search stored in Redis?
5. Where should I implement the WRR logic, in Elasticsearch or Redis? What do you think?
I appreciate any help you all can give!
3 Answers
For your WRR implementation, it might be better to handle it server-side in your application code. This gives you more flexibility to tweak weights or strategies without needing to mess with your data storage. Regarding Redis and Elasticsearch, your plan to cache search results in Redis is solid, but be sure to set a time-to-live (TTL) on those keys to manage memory better. When dealing with categories, ensure your Elasticsearch queries take relevance into account to avoid unexpected bias across categories. About the overlapping searches like "GTA 5" and "GTA," consider context-based filtering before caching results to refine what's stored in Redis.
If you're feeling overwhelmed, it might be worth hiring a developer for some guidance. But honestly, it sounds like you're on the right track and learning a lot! Using this as a practice project will actually help solidify your understanding. Just keep at it!
Related Questions
How To: Running Codex CLI on Windows with Azure OpenAI
Set Wordpress Featured Image Using Javascript
How To Fix PHP Random Being The Same
Why no WebP Support with Wordpress
Replace Wordpress Cron With Linux Cron
Customize Yoast Canonical URL Programmatically