1

What's the proper way to check whether an integer is inside an array field when filtering in a Vespa query?

Given the following field in a document:

field location_ids type array<int> {
    indexing: summary | attribute
}

I want to filter documents that contain a specific integer ID:

{'yql': 'SELECT * FROM doc WHERE userQuery() AND <int X in location_ids>',
'query': 'some query text'
}

I'm not sure how to do this with an int array, as the docs and project examples dealt mainly with string arrays.

Any help appreciated!

2 Answers2

3

For a single value X

{'yql': 'SELECT * FROM doc WHERE userQuery() AND location_ids=X',
'query': 'some query text'
}

Will match if X is in the array.

Jo Kristian Bergum
  • 2,984
  • 5
  • 8
0

Searching numeric values (equals, range etc.) is documented at https://docs.vespa.ai/en/reference/query-language-reference.html#numeric

Jon
  • 2,043
  • 11
  • 9