solr 中的布尔子句异常过多 [英] Too many boolean clauses exception in solr

查看:23
本文介绍了solr 中的布尔子句异常过多的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在框架查询中使用 OR 逻辑运算符时遇到了这些问题.我不想增加 maxBooleanClause 值.除了这个还有别的选择吗.我的 OR 范围可以达到 2 百万.我宁愿希望如果超出 maxBooleanClause 的范围而不是 solr 拆分查询,&最后合并所有子查询.这种事情可能吗?或者,如果你们中有人可以建议一些更好的技术来做到这一点.

I am facing these problem while using OR , logical operator in framing query. I dont want to increase the maxBooleanClause value. Is there any other option than this. My OR range can go upto like 2 millions.I would rather want that if range of maxBooleanClause is exceeded than solr splits up the query, & finally merge all the subqueries. Is something of these sort possible? Or if any of you can suggest some better technique to do this.

我想绘制一个图表,其中用户提供一些日期范围,例如在 2013-03-01 到 2013-06-01 之间给所有访问该应用程序的访问者.在这里,我想进行一个查询,它是所有唯一 id 的 OR.例如

I want to plot a graph where user provide some range of dates for e.g. between 2013-03-01 to 2013-06-01 gives all the visitors visiting the app. Here i want to make a query which is OR of all unique id's.For e.g.

      uniqueId:(1001 OR 1003 OR 1009 OR ........ OR 102467)

感谢帮助.

推荐答案

Solr 强加了 maxBooleanClause 正是因为这是一种超出其最佳位置的事情.最终,如果您需要数百万次搜索,那么您将需要在 Solr 之外进行自己的分发和聚合.

Solr imposes a maxBooleanClause precisely because this is the kind of thing that is outside of its sweet spot. Ultimately, if you need millions of searches, then you will need to do your own distribution and aggregation outside of Solr.

我打算大胆猜测这些子句与图相关,这是我看到此类查询最常见的地方.在这种情况下,您可能会在这里保持 Solr 的优势.

I am going to go out on a limb and guess that these clauses are graph related, which is the most common place I see these kinds of queries. In that case, it may be possible for you to stay somewhat inside Solr's strengths here.

有时反转过滤器的逻辑是有意义的,而不是传递大量值作为过滤依据,而是将这些值索引到您正在搜索的文档中,以便您以后可以传递单个值.

Sometimes it makes sense to invert the logic of your filter, and instead of passing in a large set of values to filter by, index those values onto the documents you are searching so you can pass a single value later.

例如,假设您有一个人员索引.假设您想搜索与某个特定人是朋友的人.您可以生成他们所有朋友的 ID 列表,以便过滤您的搜索.但是随后您会遇到与您在此处看到的类似的问题:大量的 OR 子句.

For example, say you have an index of people. And say you want to search for people who are friends with some specific person. You could generate the list of IDs of all their friends in order to filter your search. But then you'll have a similar problem to what you're seeing here: lots and lots of OR clauses.

或者,您可以将每个人的朋友列表索引到 Solr 中.现在,您将拥有一个包含数千个值的字段,但您的查询过滤器将只有一个值:您过滤搜索所依据的网络人员的 ID.

Alternatively, you can index each person's list of friends into Solr. Now you'll have a field with thousands of values in it, but your query filter will have only one value: the ID of the person whose network you are filtering the search by.

就搜索机制而言,这更符合 Solr 的优势.但是,这是有代价的.您需要自己管理非规范化,并且可能需要对文档进行大量更新,或者在更新图表时遇到一些延迟.

This plays more toward Solr's strengths as far as the mechanics of searching are concerned. However, there is a cost. You'll need to manage the denormalization yourself, and probably be making a lot of updates to your documents, or suffering some latency in updates to your graph.

如果这太麻烦了,您可能需要考虑另一种更好地优化图遍历的技术.

If that proves too onerous, you may need to consider a different technology better optimized for graph traversal.

这篇关于solr 中的布尔子句异常过多的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆