SOLR (3.1+) - 在同一请求中使用 OR 进行多个空间查询
是否可以在同一个 SOLR (3.1+) 请求中进行多个空间查询?
目前,我们需要允许用户通过前端搜索表单搜索其选择的位置的库存。但我们还想在幕后添加另一个空间搜索,以便包含更多库存。结果搜索将产生维恩图类型的搜索。
编辑 2011 年 4 月 10 日
构造示例: q=*:*&fq={!geofilt}&sfield=位置&(ClientId:"client1"&pt=40.68063802521456,-74.003 90625&d=80.4672)%20OR%20_query_:(ClientId:"client2"&pt=36.1146460,-115.1728160&d=80.4672)
上面的构造不起作用,但希望能展示我想要实现的目标。
Is it possible to conduct multiple spatial queries within the same SOLR (3.1+) request?
We currently have a need to allow user to search for inventory with a location of their choice via a frontend search form. But we want to also add another spatial search behind the scenes so it will include more inventory. The resulting search would result in a venn diagram type of search.
Edit 10.4.2011
Example construct: q=*:*&fq={!geofilt}&sfield=Location&(ClientId:"client1"&pt=40.68063802521456,-74.00390625&d=80.4672)%20OR%20_query_:(ClientId:"client2"&pt=36.1146460,-115.1728160&d=80.4672)
The above construct does not work, but hopefully demonstrates what I am trying to accomplish.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这已经很旧了,但似乎还没有得到完整的答案。我遇到了同样的问题,发现这个语法有效:
This is old, but it doesn't seem like it ever got a full answer. I had the same issue and found that this syntax works:
看起来,您想在一个请求中运行 N 个查询,以便每个查询获得一个结果集?!
所以字段折叠 ( http://wiki.apache.org/solr/FieldCollapsing ) 就是你想要的正在寻找。不幸的是 FieldCollapsing 仅从 3.3 开始可用。
根据您的需求,也许来自不同方面搜索的计数结果也很有用?!
It looks like, you like to run N querys in one request in order to get one result set per query?!
So Field Collapsing ( http://wiki.apache.org/solr/FieldCollapsing ) is what you are looking for. Unfortunately FieldCollapsing is only available from 3.3.
Depending on your needs, maybe counted results from different faceted searches could be also useful?!
如果您将第二个位置查询移至附加过滤器查询中,如下所示:
q=*:*&fq={!geofilt}&sfield=位置&(ClientId:"client1"&pt=40.68063802521456,-74.00390625&d=80 .4672)&fq={!geofilt}&sfield=位置&(ClientId:"client2"&pt=36.1146460,-115.1728160&d=80.4672)
这会提供您正在寻找的结果吗?它可能最终限制太多,但认为值得尝试。
您也可以尝试:
q=*:*&fq={!geofilt}&sfield=位置&((ClientId:"client1"&pt=40.68063802521456,-74. 00390625&d=80.4672)%20OR%20(ClientId:"client2"&pt=36.1146460,-115.1728160&d=80.4672))
What if you moved your second location query into an additional filter query, like below:
q=*:*&fq={!geofilt}&sfield=Location&(ClientId:"client1"&pt=40.68063802521456,-74.00390625&d=80.4672)&fq={!geofilt}&sfield=Location&(ClientId:"client2"&pt=36.1146460,-115.1728160&d=80.4672)
Will that provide the results that you are looking for? It might end up being too limiting, but thought it was worth trying.
You might also try:
q=*:*&fq={!geofilt}&sfield=Location&((ClientId:"client1"&pt=40.68063802521456,-74.00390625&d=80.4672)%20OR%20(ClientId:"client2"&pt=36.1146460,-115.1728160&d=80.4672))