How to set up SOLR parameter substitution in solrconfig.xml -
this first question @ stackoverflow apologies in advance if break rules did study them , made sure isn't duplicate question.
so, according http://yonik.com/solr-query-parameter-substitution/ 1 can set search handler in solrconfig in way
request handler defaults, appends, , invariants configured handler may reference request parameters
i have following query works fine curl
curl http://localhost:7997/solr/vb_popbio/select -d 'q=*:*&fq=bundle:pop_sample_phenotype , 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} } }'
i have translated query search handler configuration in solrconfig.xml user has provide pfield, pgap, pstart , pend parameters. here's how configuration handler looks
<!--a request handler serve data violin plots (limited ir assays)--> <requesthandler name="/irviolin" class="solr.searchhandler"> <!-- default values query parameters can specified, these overridden parameters in 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)", 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} } } </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>
notice provided default values parameters otherwise solr fail load configuration. problem using query this
curl http://localhost:7997/solr/vb_popbio/irviolin?q=*:*& &pgap=5&pstart=0&pend=101&pfield="mortality rate"
is not working. solr read request parameters fine (i can see them on debug output) ignore them , use default values in configuration instead.
solr version 5.2.1.
i tried moving configuration parameters either defaults, appends or invariants nothing working. after researching past 2 days i'm ready give , build whole query on-the-fly instead.
any appreciated.
many thanks
Comments
Post a Comment