Search Criteria and Sort Clauses¶
Search Criteria and Sort Clauses are the building blocks of a search query: Criteria select which content is returned, and Sort Clauses order the results. Cohesivo provides a number of standard Search Criteria and Sort Clauses that cover the majority of use cases.
For the full list, see the Search Criteria reference and the Sort Clause reference.
Running a search over the REST API¶
You search for content and locations with the POST /views request.
The query goes into the ViewInput element of the payload, where Criteria go into the Filter
or Query element, Sort Clauses into SortClauses, and aggregations into Aggregations.
You can limit the number of results with limit and offset.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | |
Products have their own search endpoint,
POST /product/catalog/products/view,
which takes a ProductQuery element instead.
For more information, see the Product Search Criteria reference
and the Product Sort Clauses reference.
Content and Location search¶
There are two basic types of search: you can search for content items, or for locations.
All Criteria and Sort Clauses are accepted by Location search, but not all of them can be used with Content search. The reason is that while one location always has exactly one content item, one content item can have several locations. In that context some Criteria and Sort Clauses would produce ambiguous queries, so Content search refuses the Criteria and Sort Clauses that apply specifically to locations.
With version 1.1 of the ViewInput media type
(application/vnd.ibexa.api.ViewInput+json; version=1.1), you select the type of search
by using the ContentQuery or LocationQuery element instead of Query.
Search using a custom Field Criterion¶
You can also call the POST /views request with a custom Field Criterion.
This allows you to build custom content logic queries with nested logical operators OR/AND/NOT.
Example of custom Content Query¶
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | |