Re: Bad request from solr by just changing the order in the filter query

2018-04-07 Thread Elier Delgado
On Sat, Mar 31, 2018 at 12:46 PM, Shawn Heisey 
wrote:

> On 3/31/2018 10:22 AM, Elier Delgado wrote:
>
>>   Hi, I'm working with facets in solr 7.2.1. Basically I'm following this
>> tutorial:
>> http://yonik.com/multi-select-faceting/
>>
>> The following solr request works just fine:
>>
>> &json.facet={domains:{type:terms,field:domains,domain:{exclu
>> deTags:DOMAIN}},specialties:{type:terms,field:specialties,do
>> main:{excludeTags:SPECIALTY}}}
>> &fq={!tag=SPECIALTY}specialties:(1043 1023) AND {!tag=DOMAIN}domains:100
>>
>> If I just change the order in the fq parameter, solr response with 400 Bad
>> Request.
>>
>> &json.facet={domains:{type:terms,field:domains,domain:{exclu
>> deTags:DOMAIN}},specialties:{type:terms,field:specialties,do
>> main:{excludeTags:SPECIALTY}}}
>> &fq={!tag=DOMAIN}domains:100 AND {!tag=SPECIALTY}specialties:(1043 1023)
>>
>> I would like to know if I'm doing something wrong or it if could be a
>> problem in solr.
>>
>
> You've got {!tag} placed twice in one fq.  I don't think you can do that
> -- localparams (which is what that syntax is using) generally must be at
> the very beginning of query text, and don't work when they're placed in the
> middle.
>
> Try this:
>
> &fq={!tag=DOMAIN}domains:100&fq={!tag=SPECIALTY}specialties:(1043 1023)
>
> The first request probably should have also thrown an error, and the fact
> that it didn't MIGHT be a problem.
>
> What is the full error, which should be many lines long? If you don't see
> something that's lots of lines, look in solr.log.
>
> Thanks,
> Shawn
>

Thanks Shawn, your query works but the facet counters became inconsistent.

A colleague found that by adding an space between the tag and the field the
query works as expected in any order.
Also, adding the plus sign force to match all conditions. Here is the
working query, just adding space and plus sign in fq parameter.

Can someone help to clarify if this is the expected behavior or it is just
a hack that we have found?

&json.facet={domains:{type:terms,field:domains,domain:{excludeTags:DOMAIN}},specialties:{type:terms,field:specialties,domain:{excludeTags:SPECIALTY}}}
&fq={!tag=DOMAIN} +domains:100 AND {!tag=SPECIALTY} +specialties:(1043 1023)

Thanks


Bad request from solr by just changing the order in the filter query

2018-03-31 Thread Elier Delgado
 Hi, I'm working with facets in solr 7.2.1. Basically I'm following this
tutorial:
http://yonik.com/multi-select-faceting/

The following solr request works just fine:

&json.facet={domains:{type:terms,field:domains,domain:{excludeTags:DOMAIN}},specialties:{type:terms,field:specialties,domain:{excludeTags:SPECIALTY}}}
&fq={!tag=SPECIALTY}specialties:(1043 1023) AND {!tag=DOMAIN}domains:100

If I just change the order in the fq parameter, solr response with 400 Bad
Request.

&json.facet={domains:{type:terms,field:domains,domain:{excludeTags:DOMAIN}},specialties:{type:terms,field:specialties,domain:{excludeTags:SPECIALTY}}}
&fq={!tag=DOMAIN}domains:100 AND {!tag=SPECIALTY}specialties:(1043 1023)

I would like to know if I'm doing something wrong or it if could be a
problem in solr.

Thanks!


Virus-free.
www.avg.com

<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>