vespa-engine / vespa

AI + Data, online. https://vespa.ai
https://vespa.ai
Apache License 2.0
5.47k stars 584 forks source link

Document summaries cannot contain predicates #21733

Closed albertmolinermrf closed 2 years ago

albertmolinermrf commented 2 years ago

Describe the bug When a summary of type predicate is added to a document-summary, all queries fail (even those that do not request any presentation.summary).

To Reproduce Steps to reproduce the behavior:

  1. Used sample application Predicate Search.
  2. Added the following at line 20 to src/main/application/schemas/ad.sd:
    document-summary adsummary {
    from-disk
    summary title type string {
      source: title
    }
    summary target type predicate {
      source: target
    }
    }
  3. After deploying and feeding data, the response to the application test is:
    {
    "root":{
      "id":"toplevel",
      "relevance":1.0,
      "fields":{
         "totalCount":3
      },
      "coverage":{
         "coverage":100,
         "documents":4,
         "full":true,
         "nodes":1,
         "results":1,
         "resultsFull":1
      },
      "errors":[
         {
            "code":10,
            "summary":"Backend communication error",
            "message":"Error response from rpc node connection to vespa-container:19106: Connection error"
         }
      ],
      "children":[
         {
            "id":"index:adserver/0/85cecfac5cdb8b0c17bbe05c",
            "relevance":0.0017429193899782135,
            "source":"adserver"
         },
         {
            "id":"index:adserver/0/382f7509e4bed774eb3c57ee",
            "relevance":0.0017429193899782135,
            "source":"adserver"
         },
         {
            "id":"index:adserver/0/3e26ff81baa990bebf73395a",
            "relevance":0.0017429193899782135,
            "source":"adserver"
         }
      ]
    }
    }

Expected behavior

{
   "root":{
      "id":"toplevel",
      "relevance":1.0,
      "fields":{
         "totalCount":3
      },
      "coverage":{
         "coverage":100,
         "documents":4,
         "full":true,
         "nodes":1,
         "results":1,
         "resultsFull":1
      },
      "children":[
         {
            "id":"id:sampleapp:ad::http://example.com/sled",
            "relevance":0.0017429193899782135,
            "source":"adserver",
            "fields":{
               "sddocname":"ad",
               "subqueries(target)":-1,
               "documentid":"id:sampleapp:ad::http://example.com/sled",
               "title":"ACME Rocket Sled",
               "target":"('name' in ['Wile E. Coyote'] or 'age' in [14..25])\n"
            }
         },
         {
            "id":"id:sampleapp:ad::http://example.com/boulder",
            "relevance":0.0017429193899782135,
            "source":"adserver",
            "fields":{
               "sddocname":"ad",
               "subqueries(target)":-1,
               "documentid":"id:sampleapp:ad::http://example.com/boulder",
               "title":"ACME Dehydrated Boulders",
               "target":"('name' in ['Wile E. Coyote'] or 'age' in [10..20])\n"
            }
         },
         {
            "id":"id:sampleapp:ad::http://example.com/tornado",
            "relevance":0.0017429193899782135,
            "source":"adserver",
            "fields":{
               "sddocname":"ad",
               "subqueries(target)":-1,
               "documentid":"id:sampleapp:ad::http://example.com/tornado",
               "title":"ACME Do-It Yourself Tornado Kit",
               "target":"('name' in ['Wile E. Coyote'] or 'age' in [20..40])\n"
            }
         }
      ]
   }
}

Additional context Removing target from adsummary or adding any other new field of any other type yields the expected result.

arnej27959 commented 2 years ago

confirmed, this is a bug (in config-model).

workaround: use the old syntax for putting the field in another summary, which is

        field target type predicate {
            indexing: attribute | summary
            summary {to: default, adsummary}

instead of declaring it inside the document-summary adsummary block.

jobergum commented 2 years ago

I just wanted to say thanks for the detailed bug description @albertmolinermrf!

albertmolinermrf commented 2 years ago

workaround: use the old syntax for putting the field in another summary

Thank you very much! It works.