Parent-Child Mode cannot be searched by parent column

101 Views Asked by At

I follow this article https://blog.vespa.ai/parent-child-in-vespa/

this is OK

vespa query -v 'yql=select * from ad where ad_campaign_budget < 500'

but this cannot find any result

vespa query -v 'yql=select * from ad where ad_campaign_budget < 500 and ad_campaign_company_name contains "ACME"'

i found that even if i want to search the simple advertiser like this will return no result

vespa query -v 'yql=select * from advertiser where company_name contains "ACME"'

i think maybe in advertiser.sd, field "company_name" didn't declair to indexing: index but when i add index and deploy, it shows me that index in global not support, like this

For schema 'campaign', import field 'campaign_company_name':
Field 'company_name' via reference field 'advertiser_ref':
Is an index field. Not supported

how can i let company_name filed be indexed and be searched ?

1

There are 1 best solutions below

7
On

That query example in this blog post is unfortunately wrong and will cause 0 results. Fields that are imported into child document types need to be defined with indexing: attribute. And attribute fields do not support match:text where the document text is tokenized, stemmed, and normalized and where "ACME" would match. See match. This guide also describes the difference in matching with regards to index versus attribute.