I am trying to debug an issue that I am having with the following query:
q=(Cartridge)&fq={!tag=Deals_EN_ss}Deals_EN_ss:"Clearance%20Items"%20OR%20{!tag=Deals_EN_ss}Deals_EN_ss:"On%20Promotion"&defType=edismax&facet=true&facet.field={!ex=Deals_EN_ss}Deals_EN_ss&facet.field={!key=Brand_EN_ss}Brand_EN_ss&facet.field={!key=Rating_EN_ss}Rating_EN_ss&facet.field={!key=CA_Default_Price_EN_p}CA_Default_Price_EN_p
Here, I am trying to perform a multi-select facet query, filtering on the Deals_EN_ss facet. When I run this query against my SOLR server. I get the following response back:
<response>
<lst name="responseHeader">
<int name="status">400</int>
<int name="QTime">3</int>
<lst name="params">
<str name="facet">true</str>
<str name="q">(Cartridge)</str>
<arr name="facet.field">
<str>{!ex=Deals_EN_ss}Deals_EN_ss</str>
<str>{!key=Brand_EN_ss}Brand_EN_ss</str>
<str>{!key=Rating_EN_ss}Rating_EN_ss</str>
<str>{!key=CA_Default_Price_EN_p}CA_Default_Price_EN_p</str>
</arr>
<str name="wt">xml</str>
<arr name="fq">
<str>
{!tag=Deals_EN_ss}Deals_EN_ss:"Clearance Items" OR {!tag=Deals_EN_ss}Deals_EN_ss:"On Promotion"
</str>
</arr>
<str name="defType">edismax</str>
</lst>
</lst>
<lst name="error">
<str name="msg">
org.apache.solr.search.SyntaxError: Cannot parse 'Deals_EN_ss:"On': Lexical error at line 1, column 16. Encountered: <EOF> after : "\"On"
</str>
<int name="code">400</int>
</lst>
</response>
I am not sure what I am missing here. Can anyone please help me look into the query syntax?
Tags and excludes are specified as local params {!...}
, which can only occure once at the start of each parameter.
See https://wiki.apache.org/solr/LocalParams
Your first fq
parameter contains a second illegal local param.
Try to remove the second occurance of {!tag=Deals_EN_ss}
.
Your query should look like this then:
q=(Cartridge)&fq={!tag=Deals_EN_ss}Deals_EN_ss:"Clearance%20Items"%20OR%20Deals_EN_ss:"On%20Promotion"&defType=edismax&facet=true&facet.field={!ex=Deals_EN_ss}Deals_EN_ss&facet.field={!key=Brand_EN_ss}Brand_EN_ss&facet.field={!key=Rating_EN_ss}Rating_EN_ss&facet.field={!key=CA_Default_Price_EN_p}CA_Default_Price_EN_p