Re: Syntax for parameter substitution in function queries?
Thanks very much; that does indeed work as I'd hoped/expected. On 7 August 2012 17:12, Yonik Seeley wrote: > On Tue, Aug 7, 2012 at 3:01 PM, Timothy Hill wrote: >> Hello, all ... >> >> According to >> http://wiki.apache.org/solr/FunctionQuery/#What_is_a_Function.3F, >> it is possible under Solr 4.0 to perform parameter substitutions >> within function queries. >> >> However, I can't get the syntax provided in the documentation there to >> work *at all* with Solr 4.0 out of the box: the only location at which >> function queries can be specified, it seems, is in the 'fl' parameter. >> And attempts at parameter substitutions here fail. Using (haphazardly >> guessed) syntax like >> >> select?q=*:*&fl=*, test_id:if(exists(employee), employee_id, >> socialsecurity_id), boost_id:sum($test_id, 10)&wt=xml >> >> results in the following error >> >> Error parsing fieldname: Missing param test_id while parsing function >> 'sum($test_id, 10)' > > test_id needs to be an actual request parameter. > > This worked for me on the example data: > http://localhost:8983/solr/query?q=*:*&fl=*,%20test_id:if(exists(price),id,name),%20boost_id:sum($param,10)¶m=price > > -Yonik > http://lucidimagination.com
Re: Syntax for parameter substitution in function queries?
On Tue, Aug 7, 2012 at 3:01 PM, Timothy Hill wrote: > Hello, all ... > > According to http://wiki.apache.org/solr/FunctionQuery/#What_is_a_Function.3F, > it is possible under Solr 4.0 to perform parameter substitutions > within function queries. > > However, I can't get the syntax provided in the documentation there to > work *at all* with Solr 4.0 out of the box: the only location at which > function queries can be specified, it seems, is in the 'fl' parameter. > And attempts at parameter substitutions here fail. Using (haphazardly > guessed) syntax like > > select?q=*:*&fl=*, test_id:if(exists(employee), employee_id, > socialsecurity_id), boost_id:sum($test_id, 10)&wt=xml > > results in the following error > > Error parsing fieldname: Missing param test_id while parsing function > 'sum($test_id, 10)' test_id needs to be an actual request parameter. This worked for me on the example data: http://localhost:8983/solr/query?q=*:*&fl=*,%20test_id:if(exists(price),id,name),%20boost_id:sum($param,10)¶m=price -Yonik http://lucidimagination.com
Syntax for parameter substitution in function queries?
Hello, all ... According to http://wiki.apache.org/solr/FunctionQuery/#What_is_a_Function.3F, it is possible under Solr 4.0 to perform parameter substitutions within function queries. However, I can't get the syntax provided in the documentation there to work *at all* with Solr 4.0 out of the box: the only location at which function queries can be specified, it seems, is in the 'fl' parameter. And attempts at parameter substitutions here fail. Using (haphazardly guessed) syntax like select?q=*:*&fl=*, test_id:if(exists(employee), employee_id, socialsecurity_id), boost_id:sum($test_id, 10)&wt=xml results in the following error Error parsing fieldname: Missing param test_id while parsing function 'sum($test_id, 10)' Right now I'm entertaining the following hypotheses: (i) I'm somehow borking the syntax, probably in an embarrassingly obvious way (ii) param substitutions of this type work with the syntax given in the wiki, but not with the standard query handler (iii) the wiki documentation is an artefact of development-in-progress for a feature that was subsequently dropped Can anyone on the list shed any light on this? Thanks, Tim