"

CQL (Contextual Query Language)

The 'query' parameter uses Contextual Query Language (CQL) to enable powerful searching via the URL when calling the API. Searches can vary from a simple one word to complex boolean queries. 

Example URL: 

https://api.amdigital.co.uk/1.0/cp-africa/documents?query=number%20equals%2010

Supported CQL Operators

equal (accepts =, exact, ==)

Returns items where the field is equal to the value after the operator.

e.g. number equals 10

and

When running a query this operator returns items which has one word or phrase AND another.

e.g. cats and dogs

e.g. "family cohesion" and "medical care"

or

When running a query this operator returns items which has one word or phrase OR another.

e.g. cats or dogs - returns items where cats or dogs exist in the item's metadata or full text.

e.g. "family cohesion" or "medical care" - returns items where either of these terms exist in the metadata or full text.

not

When running a query this operator returns items which has one word or phrase but NOT another.

e.g. cats not dogs - returns items where cats exists in the item's metadata or full text but not dogs.

""

Wrap quotation marks around all phrases in a search.

any

Returns items where any words after the operator appear in the required field.

e.g. title any "royal family" - returns items where royal or family appear in the title

all

Returns items where all words after the operator appear in the required field.

e.g. title all "royal family" - returns items where royal and family both appear in the title

within

Returns items where a field has values that full in a particular range. Please note this range is inclusive of the numbers specified.

e.g. number within "10 20" - returns items where the field number has values that are from 10 to 20.

<

Returns items where the field is less than the value specified.

e.g. number < 20 - returns items where the field number has values that are less than 20

<=

Returns items where the field is less than or equal to the value specified.

e.g. number < 20 - returns items where the field number has values that are less than 20 and 20

>

Returns items where the field is greater than the value specified.

e.g. number > 20 - returns items where the field number has values that are greater than 20

>=

Returns items where the field is less than or equal to the value specified.

e.g. number >= 20 - returns items where the field number has values that are greater than 20 and 20

prox

Returns item where the two terms are in close proximity (within five words) of the other.

e.g. war prox peace - returns items where war is within five words of peace.

sortBy

Sorts the items alphabetically by a specified field.

e.g. title any war sortBy number/sort.ascending - sorts the items returned where the title contains war by number ascending.

e.g. title any war sortBy number/sort.ascending - sorts the items returned where the title contains war by number but descending.