简体   繁体   English

分面搜索:ElasticSearch / Solr还是简单的数据库查询?

[英]Faceted search: ElasticSearch/Solr or a simple database query?

Forgive this super basic question, from a search newbie. 原谅来自搜索新手的这个超级基本问题。

I want to implement a site that makes use of faceted search. 我想实现一个利用多面搜索的网站。 For example, it's a site with a database of hotels, and I want to allow users to search for hotels within a price range, with a swimming pool, with either three or four stars. 例如,这是一个包含酒店数据库的网站,我希望允许用户搜索价格范围内带有三星级或四星级游泳池的酒店。

Clearly I can return results to users with a simple database query. 显然,我可以通过简单的数据库查询将结果返回给用户。

Should I use ElasticSearch or Solr to implement this instead of using a database query? 我应该使用ElasticSearch还是Solr来实现此目的,而不是使用数据库查询? If so, why? 如果是这样,为什么?

Yes you should use ES or Solr. 是的,您应该使用ES或Solr。 Reasons: primarily performance and the ability to change (think config) 'types of faceting' easily. 原因:主要是性能和轻松更改(考虑配置)“构面类型”的能力。

Faceting is no small feat and although you could do it with a RDBMS, to do it fast requires hard thinking. 构面并不是一件容易的事,尽管您可以使用RDBMS来完成,但要快速完成,就需要认真思考。 Why do it yourself if you can use the gazillions of hours Solr / ES (+ Lucene) teams have worked to optimize it. 如果您可以使用Solr / ES(+ Lucene)团队花了数百万小时的时间来优化它,那么为什么自己动手做呢。

As for the 'types of faceting' I mentioned: 至于“刻面类型”,我提到:

  1. perhaps you want to do hierarchical faceting. 也许您想进行分层构面。 Select price-category > display smaller price categories. 选择价格类别>显示较小的价格类别。 How are the bucketed: fixed range, evenly distributed, etc. Solr / ES provide these options from within a config. 如何分类:固定范围,均匀分布等。Solr/ ES从配置中提供这些选项。
  2. Perhaps instead you implement price-faceting with a slider with min/max handles? 也许您改为使用带有最小/最大手柄的滑块来实现价格方面? Do you want to display the nr of hotels while you slide (histogram/facetstats in SOlr / ES) 您要在滑动时显示酒店的nr吗(SOlr / ES中的直方图/ facetstats)
  3. While you've faceted on price, perhaps you still want to know the min and max-value of the priceslider as if you DIDN't filter on price. 当您遇到价格问题时,也许您仍然想知道priceslider的最小值和最大值,就好像您没有对价格进行过滤一样。 This is needed if you want to be able to draw the slider-handles proportionally. 如果您希望能够按比例绘制滑块手柄,则需要这样做。 (see my question on SO as part of considering a switch from Solr to ES: Elasticsearch: excluding filters while faceting possible? (like in Solr) ) (请参阅有关SO的问题,作为考虑从Solr切换到ES的一部分: Elasticsearch:在可能的情况下排除过滤器?(例如Solr)
  4. faceting on stars? 在星星上刻面? Perhaps you want to show the best price per stars-facet if the user would select that star (again histogram/ stats) 如果用户选择某颗星,那么您可能希望显示每颗星的最佳价格(再次使用直方图/统计数据)

Seriously, don't even consider doing the above with a RDBMS. 认真地说,甚至不要考虑使用RDBMS进行上述操作。 You'll go insane. 你会发疯的。

Hope that helps, and yes I'm familiar with the domain :) 希望能对您有所帮助,是的,我对域名很熟悉:)

Additional questions, just ask. 其他问题,只问。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM