加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

如何在solrconfig.xml中设置SOLR参数替换

发布时间:2020-12-16 22:46:51 所属栏目:百科 来源:网络整理
导读:这是我在stackoverflow的第一个问题,所以如果我违反任何规则,请提前道歉,但我确实研究了它们,并确保这不是一个重复的问题. 因此,根据这个http://yonik.com/solr-query-parameter-substitution/,可以在solrconfig中设置一个搜索处理程序 request handler defa
这是我在stackoverflow的第一个问题,所以如果我违反任何规则,请提前道歉,但我确实研究了它们,并确保这不是一个重复的问题.

因此,根据这个http://yonik.com/solr-query-parameter-substitution/,可以在solrconfig中设置一个搜索处理程序

request handler defaults,appends,and invariants configured for the
handler may reference request parameters

我有以下查询适用于卷曲

curl http://localhost:7997/solr/vb_popbio/select -d 'q=*:*&fq=bundle:pop_sample_phenotype AND phenotype_type_s:"insecticide%20resistance"
&rows=0&wt=json&json.nl=map&indent=true
&fq=phenotype_value_type_s:${PFIELD}&
&PGAP=5&PSTART=0&PEND=101&PFIELD="mortality rate"&
json.facet = {
            pmean: "avg(phenotype_value_f)",pperc: "percentile(phenotype_value_f,5,25,50,75,95)",pmin: "min(phenotype_value_f)",pmax: "max(phenotype_value_f)",denplot : {
                type : range,field : phenotype_value_f,gap : ${PGAP:0.1},start: ${PSTART:0},end: ${PEND:1}
            }
    }'

我已将此查询转换为solrconfig.xml中的搜索处理程序配置,因此用户只需提供PFIELD,PGAP,PSTART和PEND参数.以下是处理程序的配置外观

<!--A request handler to serve data for violin plots (limited to IR assays)-->
<requestHandler name="/irViolin" class="solr.SearchHandler">
    <!-- default values for query parameters can be specified,these
         will be overridden by parameters in the request
      -->
    <lst name="defaults">
        <str name="echoParams">explicit</str>
        <int name="rows">0</int>
        <str name="df">text</str>
        <str name="wt">json</str>
        <str name="json.nl">map</str>
        <str name="json.facet">{
            pmean: "avg(phenotype_value_f)",denplot : {
            type : range,gap: ${PGAP:0.1},end: ${PEND:1}
            }
            }
        </str>
    </lst>
    <lst name="appends">
        <str name="fq">bundle:pop_sample_phenotype</str>
        <str name="fq">phenotype_type_s:"insecticide resistance"</str>
        <str name="fq">has_geodata:true</str>
        <str name="fq">phenotype_value_type_s:${PFIELD:"mortality rate"}</str>

    </lst>
    <lst name="invariants">
    </lst>

</requestHandler>

请注意,我为所有参数提供了默认值,否则SOLR将无法加载配置.问题是使用这样的查询

curl http://localhost:7997/solr/vb_popbio/irViolin?q=*:*&
    &PGAP=5&PSTART=0&PEND=101&PFIELD="mortality rate"

不管用. SOLR将正确读取请求参数(我可以在调试输出上看到它们),但会忽略它们并使用配置中的默认值.

SOLR版本是5.2.1.

我尝试将配置参数移动到默认值,追加或不变量,但没有任何工作.经过2天的研究,我几乎已经准备好放弃,而是在运行中构建整个查询.

任何帮助将不胜感激.

非常感谢

解决方法

我认为(帖子)太旧了,但是使用搜索引擎我到了这个页面.一个简单的解决方案是逃避美元符号.之后,您应该达到理想的效果.

例:

< str name =“json.facet”> {????pmean:“avg(phenotype_value_f)”,????pperc:“百分位数(phenotype_value_f,95)”,????pmin:“min(phenotype_value_f)”,????pmax:“max(phenotype_value_f)”,????denplot:{????????类型:范围,????????字段:phenotype_value_f,????????差距:$${PGAP:0.1},????????开始:$${PSTART:0},????????结束:$${PEND:1}????}}< / STR>

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读