【问题标题】:How to use "AND", "OR" operator in solr search query?如何在 solr 搜索查询中使用“AND”、“OR”运算符?
【发布时间】:2015-10-17 05:52:33
【问题描述】:

我有点困惑,如何在 SOLR 搜索查询中使用 AND-OR 运算符。

http://127.0.0.1:8984/solr/collection1/select?q=category_name:kitchen&category_name:bathroom&reno_wall_colours:red&wt=json&start=0&rows=100&facet=on&facet.field=category_name&hl.fl=category_name

在上面的网址中,我想进行如下查询:

(category_name:kithcen AND reno_wall_colours:red) 或 (category_name:bathroom AND reno_wall_colours:red)。

【问题讨论】:

    标签: solr


    【解决方案1】:

    【讨论】:

    • 感谢您的回复。但它不工作的卷曲。 $url = "127.0.0.1:8984/solr/collection1/… OR 浴室) AND reno_wall_colours:red)&wt=json&start=0&rows=400&facet=on&facet.field=category_name"; /** 为 solr 搜索响应启动 culr**/ if (function_exists('curl_version')) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_TIMEOUT, '30'); $result = trim(curl_exec($ch)); curl_close($ch); $solrJsonData = json_decode($result, true);但它只在浏览器上工作
    • 但是当我把这个网址放在浏览器中时,它会给出响应。问题是什么?请帮助我
    • 使用 urlencode 正确转义 URL 或使用实际 Solr 客户端来避免手动转义(和结果集解析)。
    • 我还有一个问题是如何在查询中设置优先级。意味着如果我想始终在顶部和浴室记录之后显示厨房设备。怎么可能?
    • 您可以对搜索词使用提升:title:"foo bar"^10cwiki.apache.org/confluence/display/solr/…
    猜你喜欢
    • 2021-01-03
    • 1970-01-01
    • 1970-01-01
    • 2011-09-01
    • 1970-01-01
    • 2014-10-22
    • 2015-04-28
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多