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 Uwe Reh <re...@hebis.uni-frankfurt.de> on 2013/02/01 22:35:55 UTC

Nested function query must use ....

Hi,

should be easy, but I'm to blind to find the correct syntax (Solr4.1)

Problem:
I' have some documents in the index, because of their structure they 
tend to get too high scores. This documents are easy to identify and I 
want to boost the others to get a fair ranking.

Could anyone give my the correct syntax to accomplish this simplified 
query?  "...q=*:*&fl=foo:exists(query(id:3))"

Uwe

Example:
> <response>
> <lst name="responseHeader">
>   <int name="status">400</int>
>   <int name="QTime">2</int>
>   <lst name="params">
>     <str name="fl">foo:exists(query(id:3))</str>
>     <str name="q">*:*</str>
>   </lst>
> </lst>
> <lst name="error">
>   <str name="msg">Error parsing fieldname: Nested function query must use $param or {!v=value} forms. got 'exists(query(id:3))'</str>
>   <int name="code">400</int>
> </lst>
> </response>

But "...q=*:*&fl=foo:exists(id)" works
> <response>
> <lst name="responseHeader">
>   <int name="status">0</int>
>   <int name="QTime">1</int>
>   <lst name="params">
>     <str name="fl">foo:exists(id)</str>
>     <str name="q">*:*</str>
>     <str name="rows">1</str>
>   </lst>
> </lst>
> <result name="response" numFound="17322225" start="0">
>   <doc>
>     <bool name="foo">true</bool></doc>
> </result>
> </response>


Re: Nested function query must use ....

Posted by Uwe Reh <re...@hebis.uni-frankfurt.de>.
Hi Jack

thanks a lot for the hint.

Am 02.02.2013 00:46, schrieb Jack Krupansky:
> I've updated the example on the Function Query wiki that you may have copied:
> http://wiki.apache.org/solr/FunctionQuery#exists
Thanks again, because the wiki page was really my start point.

Uwe



Re: Nested function query must use ....

Posted by Jack Krupansky <ja...@basetechnology.com>.
You have to do exactly what the error message tells you:

rewrite:

    query(id:3)

as:

    query({!=v'id:3'})

I've updated the example on the Function Query wiki that you may have 
copied:
http://wiki.apache.org/solr/FunctionQuery#exists

-- Jack Krupansky

-----Original Message----- 
From: Uwe Reh
Sent: Friday, February 01, 2013 4:35 PM
To: solr-user@lucene.apache.org
Subject: Nested function query must use ....

Hi,

should be easy, but I'm to blind to find the correct syntax (Solr4.1)

Problem:
I' have some documents in the index, because of their structure they
tend to get too high scores. This documents are easy to identify and I
want to boost the others to get a fair ranking.

Could anyone give my the correct syntax to accomplish this simplified
query?  "...q=*:*&fl=foo:exists(query(id:3))"

Uwe

Example:
> <response>
> <lst name="responseHeader">
>   <int name="status">400</int>
>   <int name="QTime">2</int>
>   <lst name="params">
>     <str name="fl">foo:exists(query(id:3))</str>
>     <str name="q">*:*</str>
>   </lst>
> </lst>
> <lst name="error">
>   <str name="msg">Error parsing fieldname: Nested function query must use 
> $param or {!v=value} forms. got 'exists(query(id:3))'</str>
>   <int name="code">400</int>
> </lst>
> </response>

But "...q=*:*&fl=foo:exists(id)" works
> <response>
> <lst name="responseHeader">
>   <int name="status">0</int>
>   <int name="QTime">1</int>
>   <lst name="params">
>     <str name="fl">foo:exists(id)</str>
>     <str name="q">*:*</str>
>     <str name="rows">1</str>
>   </lst>
> </lst>
> <result name="response" numFound="17322225" start="0">
>   <doc>
>     <bool name="foo">true</bool></doc>
> </result>
> </response>