用Elasticsearch按颜色搜索

A year ago when I updated the TLE website I dropped the “search by color” functionality. Originally, all the colors were indexed into a database table and the frontend generated some complex queries to support specific and multi-color searching. On occasion, it caused some database bottlenecks during peak loads and with some particularly complex color combinations. The color search was also a completely separate interface from searching other product attributes and availability. It was neat, but it was not a great user experience.

一年前,当我更新TLE网站的时候,我放弃了 "按颜色搜索 "的功能。最初,所有的颜色都被索引到一个数据库表中,前端生成了一些复杂的查询,以支持特定和多颜色的搜索。有时,在负载高峰期和一些特别复杂的颜色组合时,它会造成一些数据库瓶颈。颜色搜索也是一个完全独立的界面,与搜索其他产品属性和可用性不同。这很整洁,但它不是一个很好的用户体验。

It took some time to get back to the search by color functionality, but I've finally been able to get back to it and, with elasticsearch, significantly improve it.

我花了一些时间来恢复按颜色搜索的功能,但我终于能够恢复它,并通过弹性搜索,大大改善了它。

Screenshot: colorized yarn

Color Quantification

色彩量化

One of the most difficult processes of supporting color searches is to figure out the colors in products. In our case, where we had thousands of items to “colorize”, it would be easier to create an algorithm than have somebody manually pick out significant colors. When it comes to algorithms and research, the process is called color quantization. A lot of the inventory at the shop is yarn and, unfortunately, the tools I tried didn't do a good job at picking out the fiber colors (they would find significance in the numerous shadows or average colors).

支持颜色搜索的最困难的过程之一是弄清产品中的颜色。在我们的案例中,我们有数以千计的商品需要 "着色",创建一个算法比让人手动挑选出重要的颜色更容易。当涉及到算法和研究时,这个过程被称为颜色量化。店里的很多库存都是纱线,不幸的是,我试过的工具在挑选纤维颜色方面做得并不好(它们会在众多阴影或平均颜色中找到意义)。

Ultimately I ended up creating my own algorithm based on several strategies. In addition to finding the significant colors it also keeps track of their ratios making it easy to realize multi-color items vs items with accent colors. After batch processing inventory to bring colors up to date, I added hooks to ensure new images are processed for colors as they're uploaded.

最终,我在几个策略的基础上创建了自己的算法...

开通本站会员,查看完整译文。

首页 - Wiki
Copyright © 2011-2024 iteam. Current version is 2.125.0. UTC+08:00, 2024-05-04 22:16
浙ICP备14020137号-1 $访客地图$