Hoss Man created SOLR-8977:
------------------------------

             Summary: graph qparser's traversalFilter doesn't support pure 
negative queries
                 Key: SOLR-8977
                 URL: https://issues.apache.org/jira/browse/SOLR-8977
             Project: Solr
          Issue Type: Bug
            Reporter: Hoss Man


discovered this while trying to document the parser...

{code}
bin/solr -e techproducts
...

# basic graph walk works
curl 
'http://localhost:8983/solr/techproducts/query?rows=20&fl=id,manu_id_s&q=\{!graph+from=id+to=manu_id_s\}id:0579B002'
{
  "responseHeader":{
    "status":0,
    "QTime":0,
    "params":{
      "q":"{!graph from=id to=manu_id_s}id:0579B002",
      "fl":"id,manu_id_s",
      "rows":"20"}},
  "response":{"numFound":2,"start":0,"docs":[
      {
        "id":"0579B002",
        "manu_id_s":"canon"},
      {
        "id":"canon"}]
  }}

# pure negative traversalFilter (that should match all docs since field is 
bogus) actaully prevents any walking from happening
curl 
'http://localhost:8983/solr/techproducts/query?rows=20&fl=id,manu_id_s&q=\{!graph+from=id+to=manu_id_s+traversalFilter=%22-bogus_field_s:1%22\}id:0579B002'
{
  "responseHeader":{
    "status":0,
    "QTime":0,
    "params":{
      "q":"{!graph from=id to=manu_id_s 
traversalFilter=\"-bogus_field_s:1\"}id:0579B002",
      "fl":"id,manu_id_s",
      "rows":"20"}},
  "response":{"numFound":1,"start":0,"docs":[
      {
        "id":"0579B002",
        "manu_id_s":"canon"}]
  }}

# adding a match all docs to the traversalFilter to make it an explicitly 
positive query gets things working again
curl 
'http://localhost:8983/solr/techproducts/query?rows=20&fl=id,manu_id_s&q=\{!graph+from=id+to=manu_id_s+traversalFilter=%22*:*%20-bogus_field_s:1%22\}id:0579B002'
{
  "responseHeader":{
    "status":0,
    "QTime":0,
    "params":{
      "q":"{!graph from=id to=manu_id_s traversalFilter=\"*:* 
-bogus_field_s:1\"}id:0579B002",
      "fl":"id,manu_id_s",
      "rows":"20"}},
  "response":{"numFound":2,"start":0,"docs":[
      {
        "id":"0579B002",
        "manu_id_s":"canon"},
      {
        "id":"canon"}]
  }}


{code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to