Skip to content

Commit 0b762ee

Browse files
committed
Full rewrite of the extension for v1, depends on upstream updates in fields and filter
1 parent cc330ab commit 0b762ee

File tree

1 file changed

+109
-59
lines changed

1 file changed

+109
-59
lines changed

README.md

Lines changed: 109 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -2,102 +2,145 @@
22

33
- **Title:** Collection Search
44
- **Conformance Classes:**
5-
- <https://api.stacspec.org/v1.0.0/core> (required)
6-
- <https://api.stacspec.org/v1.0.0-rc.1/collection-search> (required)
7-
- <http://www.opengis.net/spec/ogcapi-common-2/1.0/conf/simple-query> (required)
8-
- Extensions (all optional):
5+
- **REQUIRED conformance classes:**
6+
- <https://api.stacspec.org/v1.0.0/core>
7+
- <https://api.stacspec.org/v1.0.0/collection-search>
8+
- <http://www.opengis.net/spec/ogcapi-common-2/1.0/conf/simple-query>
9+
- **OPTIONAL conformance classes**:
910
- Free-text search: <https://api.stacspec.org/v1.0.0-rc.1/collection-search#free-text>
10-
- Query/STACQL: <https://api.stacspec.org/v1.0.0-rc.1/collection-search#query>
11-
- Filter/CQL2: <https://api.stacspec.org/v1.0.0-rc.1/collection-search#filter>
11+
- Filter/CQL2: <https://api.stacspec.org/v1.0.0-rc.4/collection-search#filter>
1212
- Sort: <https://api.stacspec.org/v1.1.0/collection-search#sort>
13-
- Fields: <https://api.stacspec.org/v1.0.0-rc.1/collection-search#fields>
13+
- Fields: <https://api.stacspec.org/v1.0.0/collection-search#fields>
1414
- **Scope:** STAC API - Core
15-
- **[Extension Maturity Classification](https://github.com/radiantearth/stac-api-spec/tree/main/README.md#maturity-classification):** Pilot
15+
- **[Extension Maturity Classification](https://github.com/radiantearth/stac-api-spec/tree/main/README.md#maturity-classification):** Candidate
1616
- **Dependencies:**
1717
- [STAC API - Core](https://github.com/radiantearth/stac-api-spec/blob/main/core)
1818
- [STAC API - Collections](https://github.com/radiantearth/stac-api-spec/tree/main/ogcapi-features)
1919
- [OGC API - Common - Part 2: Geospatial Data](https://portal.ogc.org/files/99149)
20-
- [OGC API - Records - Part 1: Local Resource Catalogue](https://docs.ogc.org/DRAFTS/20-004.html#clause-local-resources-catalogue)
20+
- [OGC API - Records - Part 1: Local Resource Catalogue](https://docs.ogc.org/is/20-004r1/20-004r1.html#clause-local-resources-catalog)
2121
- **Owner**: @m-mohr
2222

23-
A search endpoint provides the ability to query
24-
STAC [Collections](https://github.com/radiantearth/stac-spec/blob/master/collection-spec/README.md)
25-
objects across collections.
26-
It retrieves a group of Collection objects that match the provided parameters and provides them through
27-
the `GET /collections` endpoint as well.
23+
This extension extends the STAC API `GET /collections` endpoint to support advanced search capabilities
24+
for STAC [Collections](https://github.com/radiantearth/stac-spec/blob/master/collection-spec/README.md).
2825

29-
The Collection Search endpoint by default doesn't provide any query parameters to filter and all
30-
additional behavior will be defined in [Extensions](#extensions). These extensions can be composed
31-
by an implementer to cover only the set of functionality the implementer requires.
26+
The [`GET /collections` endpoint](https://api.stacspec.org/v1.0.0/collections/#tag/Collections/operation/getCollections)
27+
doesn't provide any query parameters by default, so a beasic set of query parameters is defined in [Basics](#basics)
28+
for some rudimentary search functionality that is similar to the default items endpoint in STAC API.
29+
Additional, more advanced behavior is defined as [optional conformance classes](#optional-conformance-classes).
30+
These extensions can be composed by an implementer to cover only the set of functionality the implementer requires.
31+
32+
## Relation to OGC APIs
3233

3334
This extension is based on *[OGC API - Common - Part 2: Geospatial Data](https://portal.ogc.org/files/99149#rc-simple-query-section)*
34-
and aligned to *[OGC API - Records - Part 1: Local Resource Catalogue](https://docs.ogc.org/DRAFTS/20-004.html#clause-local-resources-catalogue)*
35+
and aligned to *[OGC API - Records - Part 1: Local Resource Catalogue](https://docs.ogc.org/is/20-004r1/20-004r1.html#clause-local-resources-catalogue)*
3536
and selectively implements a subset of their "requirements classes".
3637

3738
All functionality in *OGC API - Records - Part 1: Local Resource Catalogue* is only defined for the `GET` method (i.e. `GET /collections`).
38-
*Note:* STAC may add behavior for `POST /collections` in the future, but due to a potential conflict
39-
with the Transaction Extension, specific rules for content negotiation might be required.
4039

41-
## Pagination
40+
> [!NOTE]
41+
> STAC may add behavior for `POST /collections` in the future, but due to a potential conflict
42+
> with the Transaction Extension, specific rules for content negotiation might be required.
43+
44+
## Versioning
4245

43-
Pagination for collections works exactly as it defined for Collections in general.
44-
See [Collection Pagination](https://github.com/radiantearth/stac-api-spec/blob/main/ogcapi-features/README.md#collection-pagination)
45-
for details.
46+
The version of this extension only defines the version of the <https://api.stacspec.org/v1.0.0/collection-search>
47+
conformance class. All other conformance classes define their own version numbers, e.g.
48+
Sort is already available in v1.1.0 and as such the conformance class is
49+
<https://api.stacspec.org/v1.1.0/collection-search#sort>.
50+
51+
## Pagination
4652

47-
## Query Parameters and Fields
53+
Pagination for collections works as defined in STAC in general, through links with relation types `first`, `previous` (or `prev`), `next`, and `last`.
54+
As such, this is also how it works for the `GET /collections` endpoint. For details, please see the chapter
55+
[Collection Pagination](https://github.com/radiantearth/stac-api-spec/blob/main/ogcapi-features/README.md#collection-pagination).
4856

49-
### Basics
57+
## Basics
5058

51-
- Conformance class: `http://www.opengis.net/spec/ogcapi-common-2/1.0/conf/simple-query`
59+
- Conformance classes:
60+
- `http://www.opengis.net/spec/ogcapi-common-2/1.0/conf/simple-query`
61+
- `https://api.stacspec.org/v1.0.0-rc.1/collection-search`
5262
- Requirement class in *OGC API - Common - Part 2: Geospatial Data*: [Simple Query](https://portal.ogc.org/files/99149#rc-simple-query-section)
5363

54-
A basic set of query parameters MUST be implemented.
55-
These are aligned with the corresponding parameters in STAC API - Features and OGC API - Records:
56-
- [`bbox`](https://docs.ogc.org/DRAFTS/20-004.html#_parameter_bbox) (intersection of the given `bbox` with any of the spatial extent provided in a STAC Collection at `extent.spatial.bbox`)
57-
- [`datetime`](https://docs.ogc.org/DRAFTS/20-004.html#_parameter_datetime) (intersection of the given `datetime` with any of the temporal extent provided in a STAC Collection at `extent.temporal.interval`)
58-
- [`limit`](https://docs.ogc.org/DRAFTS/20-004.html#_parameter_limit)
64+
This defines a basic set of query parameters for spatial and temporal querying, plus pagination.
65+
Implementations of Collection Search MUST implemented the following three parameters:
5966

60-
### Extensions
67+
- [`bbox`](https://docs.ogc.org/is/20-004r1/20-004r1.html#_parameter_bbox): Spatal filtering, i.e. the intersection of the given `bbox` with any of the spatial extents provided in a STAC Collection for the path `extent.spatial.bbox`.
68+
- [`datetime`](https://docs.ogc.org/is/20-004r1/20-004r1.html#_parameter_datetime): Temporal filtering, i.e. the intersection of the given `datetime` with any of the temporal extents provided in a STAC Collection for the path `extent.temporal.interval`.
69+
- [`limit`](https://docs.ogc.org/is/20-004r1/20-004r1.html#_parameter_limit): Limits the page size.
6170

62-
#### Free text search
71+
The parameters are all aligned with the corresponding parameters in STAC API - Features and OGC API - Records.
6372

64-
- Conformance class: `https://api.stacspec.org/v1.0.0-rc.1/collection-search#free-text`
73+
### Optional conformance classes
6574

66-
A basic free-text search parameter `q` based on [OGC API - Records](https://docs.ogc.org/DRAFTS/20-004.html#_parameter_q) and the
67-
[STAC API - Free Text Search Extension](https://github.com/stac-api-extensions/freetext-search) can be added.
75+
#### Free-Text Search
76+
77+
- Conformance classes:
78+
- Basic: `https://api.stacspec.org/v1.0.0-rc.1/collection-search#free-text`
79+
- Advanced: `https://api.stacspec.org/v1.0.0-rc.1/collection-search#advanced-free-text`
80+
- Requirement class in *OGC API - Records*: [Simple Query](https://portal.ogc.org/files/99149#rc-simple-query-section)
81+
82+
This defines a new parameter, `q` that allows the user to perform free-text queries against STAC Collection metadata.
83+
You have to choose to **either** implement Basic or Advanced free-text search.
84+
This extension recommends to implement the Basic free-text search due to its simplicity.
85+
86+
The authoritative specification is the [STAC API - Free-Text Search Extension](https://github.com/stac-api-extensions/freetext-search)
87+
and this chapter is only a summary of the extension in the context of the Collection Search Extension.
88+
The basic (but *not* the advanced) free-text search is also aligned with [OGC API - Records](https://docs.ogc.org/is/20-004r1/20-004r1.html#core-query-parameters-q).
6889

6990
The specific set of text fields of a Collection to which the parameter is applied is left to the discretion of the implementation, but a recommendation is to at least consider `title`, `description` and `keywords`.
7091

71-
The search works case-insensitive and spaces have no special meaning.
72-
Any of the search terms must be present in the set of text fields (OR operaror).
92+
For basic free-text search, the search works case-insensitive and spaces have no special meaning, which means
93+
any of the search terms must be present in the set of text fields.
94+
Commas act as separator between terms and reflect an *OR* operator.
95+
For example, `q=EO,Earth Observation` would search for "Earth Observation" or "EO".
7396

74-
- In HTTP `GET` requests, all search terms must be separated by a comma. For example, if you want to search for "Earth Observation" or "EO", your query parameter should be as follows: `q=EO,Earth Observation`.
75-
- In HTTP `POST` requests, an array of search terms must be provided, for example: `{"q": ["EO", "Earth Observation"]}`.
97+
#### Filter (CQL2)
7698

77-
#### Filter (CQL)
99+
- Conformance classes: `https://api.stacspec.org/v1.0.0-rc.4/collection-search#filter`
100+
- Requirement class in *OGC API - Records*: [Local Resource Catalogue, CQL Filter](https://docs.ogc.org/is/20-004r1/20-004r1.html#clause-local-resources-catalog_filtering)
78101

79-
- Conformance classes: `https://api.stacspec.org/v1.0.0-rc.1/collection-search#filter`
80-
- Requirement class in *OGC API - Records*: [Local Resource Catalogue, CQL Filter](https://docs.ogc.org/DRAFTS/20-004.html#clause-local-resources-catalogue_cql2-filter)
102+
The Filter extension provides an expressive mechanism for searching based on Collection fields.
81103

82-
The filter extension for CQL support can be implemented, too.
83-
See <https://github.com/stac-api-extensions/filter> for details.
84-
It works as it does for Items, except that the queryables link for Collection Search is located in the response of `GET /collections` (property `links`).
85-
The path/endpoint for Collection Search queryables can be freely chosen, but SHOULD NOT conflict with `GET /queryables`.
104+
The authoritative specification is the [STAC API - Filter Extension](https://github.com/stac-api-extensions/filter)
105+
and this chapter is only a summary of the extension in the context of the Collection Search Extension.
86106

87-
#### Query (STACQL)
107+
In general, the extension works for Collections exactly as it works for Items, with the following notable differences:
88108

89-
- Conformance class: `https://api.stacspec.org/v1.0.0-rc.1/collection-search#query`
109+
- It is implemented for `GET /collections` and returns STAC Collections accordingly
110+
- The link to the queryables endpoint for Collection Search is located in the response of `GET /collections` (property `links`)
111+
- The path/endpoint for Collection Search queryables can be freely chosen, but SHOULD NOT conflict with `GET /queryables`
90112

91-
The query extension for STACQL support can be implemented, too. It works as it does for Items.
92-
See <https://github.com/stac-api-extensions/query> for details.
113+
#### Query (STACQL)
93114

94-
#### Sorting
115+
The Query extension is not available for Collection Search as it's targetet for `POST` endpoints that accept JSON.
116+
The Collection Search extension currently does not use the HTTP `POST` method, as such Query can't be implemented.
117+
Please use [Filter](#filter-cql2) instead.
118+
119+
#### Sort
95120

96121
- Conformance classes: `https://api.stacspec.org/v1.1.0/collection-search#sort`
97-
- Requirement class in *OGC API - Records*: [Local Resource Catalogue, Sorting](https://docs.ogc.org/DRAFTS/20-004.html#clause-local-resources-catalogue_sorting)
122+
- Requirement class in *OGC API - Records*: [Local Resource Catalogue, Sorting](https://docs.ogc.org/is/20-004r1/20-004r1.html#clause-local-resources-catalog_sorting)
123+
124+
The Sort extension provides a simple but extensible mechanism to order search results according to certain properties.
125+
126+
The authoritative specification is the [STAC API - Sort Extension](https://github.com/stac-api-extensions/sort)
127+
and this chapter is only a summary of the extension in the context of the Collection Search Extension.
128+
129+
In general, the extension works for Collections exactly as it works for Items, with the following notable differences:
130+
131+
- It is implemented for `GET /collections` and sorts STAC Collections accordingly
132+
- The link to the sortables endpoint for Collection Search is located in the response of `GET /collections` (property `links`)
133+
- The path/endpoint for Collection Search sortables can be freely chosen, but SHOULD NOT conflict with `GET /sortables`
98134

99-
The sort extension can be implemented, too. It works as it does for Items.
100-
See <https://github.com/stac-api-extensions/sort> for details.
135+
Additionally, Items and Collections have differences in (common) availability of properties and their location within the document.
136+
You can find some examples below:
137+
138+
| Use Case | STAC Collection | STAC Item |
139+
| --------------------- | --------------- | ------------------- |
140+
| Sort by id | id | id |
141+
| Sort by title | title | properties.title |
142+
| Temporal sorting | extent.temporal | properties.datetime |
143+
| Sort by creation time | created | properties.created |
101144

102145
Note that Items and Collections have differences in (common) availability of properties and their location within the document. You can find some examples below:
103146

@@ -110,7 +153,14 @@ Note that Items and Collections have differences in (common) availability of pro
110153

111154
#### Fields
112155

113-
- Conformance class: `https://api.stacspec.org/v1.0.0-rc.1/collection-search#fields`
156+
- Conformance class: `https://api.stacspec.org/v1.0.0/collection-search#fields`
157+
- Requirement class in *OGC API - Records*: n/a
158+
159+
The Fields extension provides a way to explicitly include or exclude specific Collection fields in the API response,
160+
usually to reduce the response size.
161+
162+
The authoritative specification is the [STAC API - Fields Extension](https://github.com/stac-api-extensions/fields)
163+
and this chapter is only a summary of the extension in the context of the Collection Search Extension.
114164

115-
The fields extension can be implemented, too. It works as it does for Items.
116-
See <https://github.com/stac-api-extensions/fields> for details.
165+
In general, the extension works for Collections exactly as it works for Items,
166+
with the only difference that the paths must fit to the structure of a Collection instead of an Item.

0 commit comments

Comments
 (0)