分面搜索的数据库结构
我正在创建一个电子商务网站,需要有一个多方面的搜索工具,以便客户可以通过类别和分类缩小产品搜索范围,其风格与 ebuyer.com 和 Newegg.com(见左图)手动菜单)。
我最初直接开始设计一个类似于 EAV 结构的数据库(我当时不知道这是什么),这最初看起来很理想,因为我可以创建无限的类别、子类别和其他产品分类(即颜色、尺寸、收件人),客户可以用来查找特定产品。然而,当我开始尝试使用 AND
条件创建 SQL 查询时,我意识到普通的简单查询变得更长且写起来更复杂。
在花了几个小时阅读了 SO 上的各种帖子和 Google 上的文章之后,我开始意识到,如果我继续使用这种方法,噩梦就会出现。
问题
像 ebuyer.com 和 Newegg.com 设计了他们的多面搜索?
我是否错过了替代方法,或者他们只是简单地采用了 EAV 结构? 我希望避免使用 Lucene/Solr 等企业解决方案。
I am creating an eCommerce site that needs to have a faceted search tool so that customers can narrow down a product search via categories and classifications in the same style as ebuyer.com and Newegg.com (See left hand menus).
I initially dived straight into designing a database that ended up similar to an EAV structure (I didn't know what this was at the time), this initially seemed ideal as I could create unlimited categories, subcategories and other product classifications (i.e. Colour, Size, Recipient) that customers could use to find specific products. However, when I started trying to create SQL queries using AND
conditions, I realised how normal simple queries became much longer and complex to write.
After spending a few hours reading through various posts on SO and articles on Google, I've come to realise the nightmare that would lye ahead if I continued with this method.
Question
How have sites like ebuyer.com and Newegg.com designed their faceted search?
Have I missed an alternative method or have they simply gone ahead with an EAV structure?
I'm looking to avoid enterprise solutions like Lucene/Solr.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我不知道他们是如何做到的,但你可以通过这样做来实现这一点:
facet 不一定是 VARCHAR。它可以是一个简单的整数,因为您的应用程序知道它的含义。
I don't know how they do it but you can achieve this by doing:
facet doesn't have to be VARCHAR. It can be a simple INTEGER as your application knows what it means.
那么为什么你称 Lucene/Solr 企业明智的解决方案......在我看来似乎完全符合你的需求。
Well why do you call Lucene/Solr entreprise wise solution... seems to fit perfectly your need in my opinion.
我认为您正在混合不同的概念(这反过来可能会使找到解决方案变得更加困难)。
分面搜索基本上意味着按“项目”的特定质量进行过滤。该质量或属性可能是它所属的一个类别,也可能是其他东西。
您可以对用户进行分面搜索,按年龄进行过滤,例如
,如何调整 Solr(或 Sphinx)以获得最终结果可能会有所不同,但它对您的数据模型没有影响。
我首先对您试图在数据库中表示/存储的内容进行概念化/建模。如何显示它或搜索它稍后再说。
如果没有更多细节,您关于其他网站如何设计分面搜索的问题过于宽泛,同时又非常简单:您只需要根据产品的不同属性生成不同的分面即可;但您似乎还想知道他们如何建模数据库来存储信息。
I think you're mixing different concepts (which in turn may make it more difficult to find a solution).
Faceted search means basically filtering by a specific quality of the "item". That quality or property may be a category it is in, or it may be something else.
You could have a faceted search of users where you filter by their age, for example
How you adjust Solr (or Sphinx) to get the end result might vary, but it has no influence in your data model.
I would start by conceptualizing/modeling what you're trying to represent/store in the database. How you display it or search it comes later.
Without more details, your question about how other sites
designed their faceted search
is too broad, and at the same time very simple: you just need to generate the different facets based on the different properties of the products; but you also seem to want to know how they have modeled their database to store the information.http://wiki.apache.org/solr/PublicServers
Ebuyer 使用 solr 是有充分理由的,你可能会面临重新发明轮子的风险。
http://wiki.apache.org/solr/PublicServers
Ebuyer uses solr and for good reason, you risk reinventing the wheel.