You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by outre <sp...@hotmail.com> on 2008/11/29 02:33:10 UTC

Function Queries

Hi,

I was wondering if function queries are supported in SOLR1.3?

I looked thru http://wiki.apache.org/solr/FunctionQuery, and tried to run an
example on my SOLR setup. It doesn't seem though that _val_ hook has any
effect on sorting, and "score" parameter doesn't seem to return computed
values.

In my index I have fields "price" (double) and "store"(string), and just for
the sake of an example all I am doing is multiplying the price by 2. So my
query looks like this:
q=store:"adidas"&_val_:"product(price,2)"&fl=store,price,score

Based on wiki, I'd expect to see doubled price in the score field, but I
seem to be getting SOLR document scores. Am I misunderstanding something
here?

Thanks
-- 
View this message in context: http://www.nabble.com/Function-Queries-tp20742850p20742850.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: Function Queries

Posted by outre <sp...@hotmail.com>.
Just to confirm. The query works if written as in Yonik's comment. 

Thanks 

Yonik Seeley wrote:
> 
> On Fri, Nov 28, 2008 at 8:33 PM, outre <sp...@hotmail.com> wrote:
>>
>> Hi,
>>
>> I was wondering if function queries are supported in SOLR1.3?
>>
>> I looked thru http://wiki.apache.org/solr/FunctionQuery, and tried to run
>> an
>> example on my SOLR setup. It doesn't seem though that _val_ hook has any
>> effect on sorting, and "score" parameter doesn't seem to return computed
>> values.
>>
>> In my index I have fields "price" (double) and "store"(string), and just
>> for
>> the sake of an example all I am doing is multiplying the price by 2. So
>> my
>> query looks like this:
>> q=store:"adidas"&_val_:"product(price,2)"&fl=store,price,score
> 
> _val_ is a magic field name for the lucene/solr query parser.
> So try something with _val_ in the query string:
> q=_val_:"product(price,2)"
> 
> -Yonik
> 
>> Based on wiki, I'd expect to see doubled price in the score field, but I
>> seem to be getting SOLR document scores. Am I misunderstanding something
>> here?
>>
>> Thanks
>> --
>> View this message in context:
>> http://www.nabble.com/Function-Queries-tp20742850p20742850.html
>> Sent from the Solr - User mailing list archive at Nabble.com.
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/Function-Queries-tp20742850p20785707.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: Function Queries

Posted by Yonik Seeley <yo...@apache.org>.
On Fri, Nov 28, 2008 at 8:33 PM, outre <sp...@hotmail.com> wrote:
>
> Hi,
>
> I was wondering if function queries are supported in SOLR1.3?
>
> I looked thru http://wiki.apache.org/solr/FunctionQuery, and tried to run an
> example on my SOLR setup. It doesn't seem though that _val_ hook has any
> effect on sorting, and "score" parameter doesn't seem to return computed
> values.
>
> In my index I have fields "price" (double) and "store"(string), and just for
> the sake of an example all I am doing is multiplying the price by 2. So my
> query looks like this:
> q=store:"adidas"&_val_:"product(price,2)"&fl=store,price,score

_val_ is a magic field name for the lucene/solr query parser.
So try something with _val_ in the query string:
q=_val_:"product(price,2)"

-Yonik

> Based on wiki, I'd expect to see doubled price in the score field, but I
> seem to be getting SOLR document scores. Am I misunderstanding something
> here?
>
> Thanks
> --
> View this message in context: http://www.nabble.com/Function-Queries-tp20742850p20742850.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>
>