Hello, Edwin. {!foo} syntax is surprising when a query string contains space. Thus, it.s gonna be fine if there is no space in child query. You can solve it with referencing fq=-{!parent%20which=%22contentType_s:Header%22 v=$childq}&childq=matNo_s:(*88060*%20*88061*) <http://localhost:8983/solr/test/select?q=contentType_s:Header%20AND%20date_dt:[2016-01-01T00:00:00Z%20TO%202017-01-01T00:00:00Z]&fq=-{!parent%20which=%22contentType_s:Header%22}matNo_s:(*88060*%20*88061*)&json.facet={client_s:{type:terms,field:client_s,%20limit:200,%20offset:0,%20mincount:1}}&facet.threads=-1&fl=null&rows=0>
07 апр. 2017 г. 13:43 пользователь "Zheng Lin Edwin Yeo" < edwinye...@gmail.com> написал: > Hi, > > When I do the Not Contains query, I get the following error when I do it in > the following way: > > *Not working* > 1) When put the "-" sign before the {!parent which} > > http://localhost:8983/solr/test/select?q=contentType_s: > Header%20AND%20date_dt:[2016-01-01T00:00:00Z%20TO%202017- > 01-01T00:00:00Z]&fq=-{!parent%20which=%22contentType_s: > Header%22}matNo_s:(*88060*%20*88061*)&json.facet={client_s:{ > type:terms,field:client_s,%20limit:200,%20offset:0,% > 20mincount:1}}&facet.threads=-1&fl=null&rows=0 > > This is the error message that I get: > { > "responseHeader":{ > "zkConnected":true, > "status":400, > "QTime":1}, > "error":{ > "metadata":[ > "error-class","org.apache.solr.common.SolrException", > "root-error-class","org.apache.solr.parser.ParseException"], > "msg":"org.apache.solr.search.SyntaxError: Cannot parse > 'matNo_s:(*88060*': Encountered \"<EOF>\" at line 1, column 28.\r\nWas > expecting one of:\r\n <AND> ...\r\n <OR> ...\r\n <NOT> ...\r\n > \"+\" ...\r\n \"-\" ...\r\n <BAREOPER> ...\r\n \"(\" ...\r\n > \")\" ...\r\n \"*\" ...\r\n \"^\" ...\r\n <QUOTED> ...\r\n > <TERM> ...\r\n <FUZZY_SLOP> ...\r\n <PREFIXTERM> ...\r\n > <WILDTERM> ...\r\n <REGEXPTERM> ...\r\n \"[\" ...\r\n \"{\" > ...\r\n <LPARAMS> ...\r\n \"filter(\" ...\r\n <NUMBER> ...\r\n > ", > "code":400}} > *Not working* > 2) When I put the "-" sign just before the matNo > > http://localhost:8983/solr/test/select?q=contentType_s: > Header%20AND%20date_dt:[2016-01-01T00:00:00Z%20TO%202017- > 01-01T00:00:00Z]&fq={!parent%20which=%22contentType_s: > Header%22}-matNo_s:(*88060*%20*88061*)&json.facet={client_ > s:{type:terms,field:client_s,%20limit:200,%20offset:0,% > 20mincount:1}}&facet.threads=-1&fl=null&rows=0 > > There is no result returned for this: > { > "responseHeader":{ > "zkConnected":true, > "status":0, > "QTime":0}, > "response":{"numFound":0,"start":0,"docs":[] > }, > "facets":{ > "count":0}} > > *Working* > I need to include the field parentId_s:* to match all query first > > http://localhost:8983/solr/test/select?q=contentType_s: > Header%20AND%20date_dt:[2016-01-01T00:00:00Z%20TO%202017- > 01-01T00:00:00Z]&fq={!parent%20which=%22contentType_s: > Header%22}parentId_s:* > AND -matNo_s:(88060* > 88061*)&json.facet={client_s:{type:terms,field:client_s,% > 20limit:200,%20offset:0,%20mincount:1}}&facet.threads=-1&fl=null&rows=0 > > However, this is an inefficient way to get the Not Contain. By right, we > should be able to get the results from the first two examples. Can this be > consider a bug? > > I'm using Solr 6.4.2. > > > Regards, > Edwin >