Error using multiple terms in function query

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Error using multiple terms in function query

shamik
Hi,

  I'm having issues using multiple terms in Solr function queries. For e.g.
I'm trying to use the following bf function using termfreq

bf=if(termfreq(ProductLine,'Test Product'),5,0)

This throws  org.apache.solr.search.SyntaxError: Missing end to unquoted
value starting at 28 str='if(termfreq(ProductLine,Test'

If I use only Test or Product i.e. a single term, the function works as
expected. I'm seeing a similar problem with other functions like
docfreq,ttf,tf,idf,etc. I'm using 6.6 but verified similar issue in 5 as
well.

Just wondering if this is an existing issue or something not supported by
Solr. Is there an alternate way to check multiple terms in a function?

Any pointers will be appreciated.
Reply | Threaded
Open this post in threaded view
|

Re: Error using multiple terms in function query

Yonik Seeley
Problems like this are usually caused by the whole query not even
making it to Solr due to bad HTTP param encoding.
For example, if you're using curl with request parameters in the URL,
you need to manually encode spaces as either "+" or "%20"

-Yonik


On Tue, May 15, 2018 at 7:41 PM, Shamik Bandopadhyay <[hidden email]> wrote:

> Hi,
>
>   I'm having issues using multiple terms in Solr function queries. For e.g.
> I'm trying to use the following bf function using termfreq
>
> bf=if(termfreq(ProductLine,'Test Product'),5,0)
>
> This throws  org.apache.solr.search.SyntaxError: Missing end to unquoted
> value starting at 28 str='if(termfreq(ProductLine,Test'
>
> If I use only Test or Product i.e. a single term, the function works as
> expected. I'm seeing a similar problem with other functions like
> docfreq,ttf,tf,idf,etc. I'm using 6.6 but verified similar issue in 5 as
> well.
>
> Just wondering if this is an existing issue or something not supported by
> Solr. Is there an alternate way to check multiple terms in a function?
>
> Any pointers will be appreciated.