Search and filtering

Search and filtering

You can use a variety of query parameters to search and filter items in the response from any collection including folders, documents, images, content types, users or any other content with built-in or custom content type.


The $filter option defines a subset of the entries from a specified collection. The filter expression can contain global functions and operations according to the OData standard.

Filtering by Field value

The following example returns the items that have an Index greater than 11.

Copy$filter=Index gt 11

The following example returns true if the Description field (given as second param) contains the given string.

Copy$filter=substringof('Lorem', Description) eq true

The following example returns true if the given Name field starts with the given string.

Copy$filter=startswith(Name, 'Document') eq true

The following example returns true if the given Name field ends with the given string.

Copy$filter=endswith(Name, 'Library') eq true

Filtering by Date

Following example returns the documents that were uploaded after the given date.

Copy$filter=CreationDate gt datetime'2019-03-26T03:55:00'

Filtering by an exact Type

Since sensenet supports content type inheritance there are two ways to filter items by their types.

The following example shows how to get items with an exact type skipping the contents with one of the inherited types.

Copy$filter=ContentType eq 'Folder'

Filtering by Type family

In most of the cases you will use the IsOf() operation to filter by type family (by a content type and all of its inherited ones).

The response of the following example will return every content with the type Folder or any inherited type.


Query option

There is a reserved custom query option: query (without "$" prefix) that helps to get filtered collection of entities with Content Query. The scope of the query is the subtree with requested entity as a root.

Check the next big section of docs about querying in details HERE.