Does an empty query value can cause an "org.apache.solr.search.SyntaxError" error?

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

Does an empty query value can cause an "org.apache.solr.search.SyntaxError" error?

nettadalet
We are using Solr 4.6
(yes, I know. We plan an update in the near future)

I get the following error:
org.apache.solr.common.SolrException: org.apache.solr.search.SyntaxError:
Cannot parse '((TITLE_Name_t:( la verita))) AND ((TITLE_Artist_t:( ))) AND
(TITLE_Type_e : "Audio")': Encountered " ")" ") "" at line 1, column 53.

I think it is because of the TITLE_Artist_t:( )
It happens even when I change it to TITLE_Artist_t:()
but when I add some string inside the parenthesis (i.e.
TITLE_Artist_t:(abc)), it works fine.

Can anyone show me if and where it is written that an empty value can cause
an org.apache.solr.search.SyntaxError?




--
Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html
Reply | Threaded
Open this post in threaded view
|

Re: Does an empty query value can cause an "org.apache.solr.search.SyntaxError" error?

Shawn Heisey-2
On 11/7/2018 5:10 AM, nettadalet wrote:

> I get the following error:
> org.apache.solr.common.SolrException: org.apache.solr.search.SyntaxError:
> Cannot parse '((TITLE_Name_t:( la verita))) AND ((TITLE_Artist_t:( ))) AND
> (TITLE_Type_e : "Audio")': Encountered " ")" ") "" at line 1, column 53.
>
> I think it is because of the TITLE_Artist_t:( )
> It happens even when I change it to TITLE_Artist_t:()
> but when I add some string inside the parenthesis (i.e.
> TITLE_Artist_t:(abc)), it works fine.
>
> Can anyone show me if and where it is written that an empty value can cause
> an org.apache.solr.search.SyntaxError?

I don't know whether that actually is written anywhere.  I suspect it's not.

I do think that it is proper for empty parentheses to throw a syntax
error.  The text of the exception message is saying that the parser
encountered the ) character at a point when it did not expect to
encounter that character.

Thanks,
Shawn

Reply | Threaded
Open this post in threaded view
|

Unable to get Solr Graph Traversal working

Vidhya Kailash
I am unable to get even simple graph traversal expressions like the one
below to work in my environment (7.4 and 7.5 versions). They simply yield
no results, even though I know the data exists.
curl --data-urlencode 'expr=gatherNodes(rec_coll,

walk="35d40c4b9d6ddfsdf45cbb0fe4aesd75->USER_ID",
                                        gather="ITEM_ID")'
http://localhost:8983/solr/rec_coll/graph

Can someone help?

thanks
Vidhya
Reply | Threaded
Open this post in threaded view
|

Re: Unable to get Solr Graph Traversal working

Joel Bernstein
The basic syntax looks ok. Try it first on the /stream handler to rule out
any issues that might be related to /graph handler. Can you provide the
logs from one of the shards in the rec_coll collection that are generated
by this request? The logs will show the query that is actually being run on

Joel Bernstein
http://joelsolr.blogspot.com/


On Wed, Nov 7, 2018 at 1:22 PM Vidhya Kailash <[hidden email]>
wrote:

> I am unable to get even simple graph traversal expressions like the one
> below to work in my environment (7.4 and 7.5 versions). They simply yield
> no results, even though I know the data exists.
> curl --data-urlencode 'expr=gatherNodes(rec_coll,
>
> walk="35d40c4b9d6ddfsdf45cbb0fe4aesd75->USER_ID",
>                                         gather="ITEM_ID")'
> http://localhost:8983/solr/rec_coll/graph
>
> Can someone help?
>
> thanks
> Vidhya
>
Reply | Threaded
Open this post in threaded view
|

Re: Does an empty query value can cause an "org.apache.solr.search.SyntaxError" error?

nettadalet
In reply to this post by Shawn Heisey-2
Shawn Heisey-2 wrote

> I don't know whether that actually is written anywhere.  I suspect it's
> not.
>
> I do think that it is proper for empty parentheses to throw a syntax
> error.  The text of the exception message is saying that the parser
> encountered the ) character at a point when it did not expect to
> encounter that character.
>
> Thanks,
> Shawn

Thank you for your answer



--
Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html
Reply | Threaded
Open this post in threaded view
|

Re: Does an empty query value can cause an "org.apache.solr.search.SyntaxError" error?

nettadalet
In reply to this post by Shawn Heisey-2
Shawn Heisey-2 wrote

> I don't know whether that actually is written anywhere.  I suspect it's
> not.
>
> I do think that it is proper for empty parentheses to throw a syntax
> error.  The text of the exception message is saying that the parser
> encountered the ) character at a point when it did not expect to
> encounter that character.
>
> Thanks,
> Shawn

Thank you for your answer



--
Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html
Reply | Threaded
Open this post in threaded view
|

Re: Unable to get Solr Graph Traversal working

Vidhya Kailash
In reply to this post by Joel Bernstein
thanks Joel. Running with /stream handler did reveal some issues and after
fixing the same the gagtherNodes expr is working!! I am trying out the
recommendations sample from solr website for my use case and now I am
struck at the next step which is unable to get the top 3 of those nodes:
curl --data-urlencode 'expr=top(n="30",
                    sort="count(*) desc",
                    nodes(rec_coll,
                                search(rec_coll,
q="35d40c4b9d6ddfsdf45cbb0fe4aesd75->USER_ID",  fl="ITEM_ID",
sort="ITEM_ID desc", qt="/export"),
                                walk="ITEM_ID->ITEM_ID",
                                gather="USER_ID", fl="USER_ID",
                                maxDocFreq="10000",
                                count(*)))'
http://localhost:8983/solr/rec_coll/graph


Again appreciate any help....

Vidhya


On Thu, Nov 8, 2018 at 1:23 PM Joel Bernstein <[hidden email]> wrote:

> The basic syntax looks ok. Try it first on the /stream handler to rule out
> any issues that might be related to /graph handler. Can you provide the
> logs from one of the shards in the rec_coll collection that are generated
> by this request? The logs will show the query that is actually being run on
>
> Joel Bernstein
> http://joelsolr.blogspot.com/
>
>
> On Wed, Nov 7, 2018 at 1:22 PM Vidhya Kailash <[hidden email]>
> wrote:
>
> > I am unable to get even simple graph traversal expressions like the one
> > below to work in my environment (7.4 and 7.5 versions). They simply yield
> > no results, even though I know the data exists.
> > curl --data-urlencode 'expr=gatherNodes(rec_coll,
> >
> > walk="35d40c4b9d6ddfsdf45cbb0fe4aesd75->USER_ID",
> >                                         gather="ITEM_ID")'
> > http://localhost:8983/solr/rec_coll/graph
> >
> > Can someone help?
> >
> > thanks
> > Vidhya
> >
>


--
Vidhya Kailash
Reply | Threaded
Open this post in threaded view
|

Re: Does an empty query value can cause an "org.apache.solr.search.SyntaxError" error?

Shawn Heisey-2
In reply to this post by nettadalet
On 11/7/2018 11:36 PM, nettadalet wrote:
> Shawn Heisey-2 wrote
>> I do think that it is proper for empty parentheses to throw a syntax
>> error.  The text of the exception message is saying that the parser
>> encountered the ) character at a point when it did not expect to
>> encounter that character.

A little further thought on this:

When using code to construct query strings, I think a situation can
easily arise where a query clause is optional, and the "()" string, with
or without whitespace between the parentheses, ends up in the generated
query.

I understand why the query parser complains about that syntax ... but I
don't think it would be unreasonable for Solr's query parsers (lucene
and edismax probably) to just handle it as if it were not there.

My bias would be to open an enhancement issue in Jira.  I did some
searching and didn't find an existing issue, which is surprising. It
could be that there's an existing issue but I was not searching for the
right keywords.  Before an issue is opened, I'd like to hear what the
community thinks.

Thanks,
Shawn