2

While testing out parent/child feature, created 2 schemas.

Child schema:

schema item {
    document item {
        field id type long {
            indexing : attribute
        }
        field campaign_ref type reference<campaign> {
            indexing: attribute
        }
    }
    import field campaign_ref.cpc as campaign_cpc {}
    import field campaign_ref.syndicator_id as syndicator_id {}

}

And parent schema:

schema campaign {
    document campaign {
        field id type long {
            indexing : attribute
        }
        field cpc type float {
            indexing : attribute
        }
        field syndicator_id type long {
            indexing : attribute
        }
    }
}

This worked fine. Then added to the child's summary an imported field - but it wasn't appearing the search response.

Child schema change:

schema item {
document item {
    field id type long {
        indexing : attribute
    }
    field campaign_ref type reference<campaign> {
        indexing: attribute
    }
}
import field campaign_ref.cpc as campaign_cpc {}
import field campaign_ref.syndicator_id as syndicator_id {}

document-summary item_summary {
    summary syndicator_id type long {}
}

}

The test contains a single child and a single parent.

{"yql" : "select * from item where syndicator_id = 1 limit 3" }

Retrieves the item child document that is mapped to a campaign with a syndicator_id=1. But syndicator_id doesn't appear in the fields:

        "children": [
        {
            "id": "id:candidation:item::2",
            "relevance": 0.0017429193899782135,
            "source": "vespa2",
            "fields": {
                "sddocname": "item",
                "documentid": "id:candidation:item::2"
            }
        }
    ]
S.Glick
  • 63
  • 3

1 Answers1

2

You need to ask for the item_summary in the query request:

{
"yql" : "select * from item where syndicator_id = 1 limit 3",
"presentation.summary": "item_summary"
}

In the above example, you request the default document summary (implicit by not mentioning it in the request).

See https://docs.vespa.ai/en/parent-child.html and https://docs.vespa.ai/en/document-summaries.html

Jo Kristian Bergum
  • 2,984
  • 5
  • 8