Search documents

Search documents searches the document store for documents that match the search criteria.

The search criteria are arranged as a series of filters. Each filter is for one dimension. There may be more than one filter for a dimension. A document is considered a match if it matches one filter for that dimension (i.e. dimensions are ANDed together, dimension values are ORed together).

{
"filters": [
{
"dimension_reference": "textRef",
"dimension_type": "text",
"value": "value"
},
{
"dimension_reference": "dateRef",
"dimension_type": "dateRange",
"from": "yyyy-mm-dd",
"to": "yyyy-mm-dd"
}, ...
],
"latest": true|false
}

The properties of the filter depend on the type of the dimension. For text dimensions, a value match is used. For date dimensions, a from and to date are used. to is inclusive (i.e. the last date), and from and to are both optional.

If latest is set to true, then for each unique document_key value, only the documents with the highest document_received_timestamp for their document_key are returned. This is typically used with a search on document_key. 

Partial matches on document_key are supported, so, for example, a document_key of "supplier/123456/*" will return all the document the keys of which start with "supplier/123456". The * wildcard can only be used to replace whole parts of the document key, i.e. "supplier/123*" would not match "supplier/123456". 

If you do not want to search using a document_key wildcard, then get document provides a much more efficient method where a document may have multiple versions.

Response

The response from either flavour of search is an object with a results array. Each document also contains a worker reference to the worker that created it.

{
"results": [
{
"score": score,
"document_uuid": "uuid",
...
"worker": {
"worker_uuid": "uuid",
...
}
}, ... more documents ...
]
}

The document may have a score property which indicates the strength of the match, higher scores are a closer match.