Re: Bad request from solr by just changing the order in the filter query
On 4/7/2018 1:54 PM, Elier Delgado wrote: Thanks Shawn, your query works but the facet counters became inconsistent. What *exactly* was wrong? Is it possible that it was working the way it was designed to work, but different than you expected? If you really think what you're getting is wrong, we'll take your report seriously, but to go anywhere, evidence of a problem will need to be available. 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) You've still got the {!tag} localparam twice in one query string. That's the fundamental problem I was highlighting. Even if you've found some syntax that makes it function, I don't think it's right. And the workaround might stop working in a future version, when the feature is improved or a bug gets fixed. Thanks, Shawn
Re: Bad request from solr by just changing the order in the filter query
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
Re: Bad request from solr by just changing the order in the filter query
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:{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. 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