Skip to content

Commit 288de2d

Browse files
committed
Rewrite Free-Text Search extension (fixes #3, #5, #6)
1 parent 21831ba commit 288de2d

File tree

3 files changed

+48
-34
lines changed

3 files changed

+48
-34
lines changed

.swagger-codegen-ignore

Lines changed: 0 additions & 23 deletions
This file was deleted.

.swagger-codegen/VERSION

Lines changed: 0 additions & 1 deletion
This file was deleted.

README.md

Lines changed: 48 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,63 @@
33
- **Title:** Free-Text Search
44
- **OpenAPI specification:** [openapi.yaml](openapi.yaml)
55
- **Conformance Classes:**
6-
- <https://api.stacspec.org/v1.0.0-beta.2/item-search#free-text-search>
6+
- <https://api.stacspec.org/v1.0.0-rc.1/item-search#free-text>
7+
- <https://api.stacspec.org/v1.0.0-rc.1/item-search#advanced-free-text>
8+
- <https://api.stacspec.org/v1.0.0-rc.1/collection-search#free-text>
9+
- <https://api.stacspec.org/v1.0.0-rc.1/collection-search#advanced-free-text>
10+
- <https://api.stacspec.org/v1.0.0-rc.1/ogcapi-features#free-text>
11+
- <https://api.stacspec.org/v1.0.0-rc.1/ogcapi-features#advanced-free-text>
712
- **Scope:** STAC API - Core
813
- **[Extension Maturity Classification](https://github.com/radiantearth/stac-api-spec/tree/main/README.md#maturity-classification):** Proposal
9-
- **Dependencies:**
10-
- [STAC API - Core](https://github.com/radiantearth/stac-api-spec/tree/v1.0.0-rc.2/core)
14+
- **Dependencies:** (any of)
15+
- [STAC API - Collection Search](https://github.com/stac-api-extensions/collection-search)
16+
- [STAC API - Item Search](https://github.com/radiantearth/stac-api-spec/tree/v1.0.0/item-search)
17+
- [STAC API - Features](https://github.com/radiantearth/stac-api-spec/tree/v1.0.0/ogcapi-features)
1118
- **Owner**: @agstephens
1219

13-
This defines a new parameter, `q` that allows the user to perform free-text queries against the item properties.
20+
This defines a new parameter, `q` that allows the user to perform free-text queries against STAC metadata.
1421
The value of the parameter is a string and is passed to the underlying backend for free-text searches.
15-
Queries can be executed either against all string property fields or against specific fields and can make use of `AND` and `OR`
16-
operators.
22+
The specific set of text fields 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`. It is also allowed to query against all text fields.
1723

1824
This extension sits somewhere between the basic API and the [Filter Extension](https://github.com/radiantearth/stac-api-spec/tree/master/fragments/filter) providing
1925
more powerful query features than the raw API but without the flexibility and increased operators of the filter plugin. This should mostly be used to provide
2026
the ability to search for keywords across all properties with more complex queries and faceted search being provided by the filter extension.
2127

22-
## HTTP GET
28+
This extension defines two flavors of free text search.
29+
A simple one that is aligned with [OGC API - Records](https://docs.ogc.org/DRAFTS/20-004.html#_parameter_q) and
30+
a more advanced one.
31+
Both variants can be implemented against any of the search endpoints (Collection Search, Item Search, Features).
2332

24-
### Examples
33+
## Basic
34+
35+
### HTTP GET / POST
36+
37+
**Conformance Classes:**
38+
- Item Search (global): <https://api.stacspec.org/v1.0.0-rc.1/item-search#free-text>
39+
- Collection Search: <https://api.stacspec.org/v1.0.0-rc.1/collection-search#free-text>
40+
- Features (item search per collection): <https://api.stacspec.org/v1.0.0-rc.1/ogcapi-features#free-text>
41+
42+
The basic free-text search adds a `q` query parameter to the request URI.
43+
See <https://docs.ogc.org/DRAFTS/20-004.html#_parameter_q> for details.
44+
45+
The search works case-insensitive and spaces have no special meaning.
46+
Any of the search terms must be present in the set of text fields (OR operaror).
47+
48+
- 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`.
49+
- In HTTP `POST` requests, an array of search terms must be provided, for example: `{"q": ["EO", "Earth Observation"]}`.
50+
51+
## Advanced
52+
53+
**Conformance Classes:**
54+
- Item Search (global): <https://api.stacspec.org/v1.0.0-rc.1/item-search#advanced-free-text>
55+
- Collection Search: <https://api.stacspec.org/v1.0.0-rc.1/collection-search#advanced-free-text>
56+
- Features (item search per collection): <https://api.stacspec.org/v1.0.0-rc.1/ogcapi-features#advanced-free-text>
57+
58+
**OpenAPI document:** [openapi.yaml](openapi.yaml)
59+
60+
### HTTP GET
61+
62+
**Examples:**
2563

2664
| URL Example | Summary | Detail |
2765
| ----------- | ------- | ------ |
@@ -33,9 +71,9 @@ the ability to search for keywords across all properties with more complex queri
3371
| `/search?q=(quick OR brown) AND fox` | Parentheses can be used to group terms | This will search for matching items where `properties.*` CONTAINS `"quick"` OR `"brown"` AND `"fox"` |
3472
| `/search?q=quick +brown -fox` | Indicate included and excluded terms using `+`/`-` | This will search for items where `properties.*` INCLUDES `"brown"` EXCLUDES `"fox"` OR CONTAINS `"quick"` |
3573

36-
## HTTP POST
74+
### HTTP POST
3775

38-
When calling the relevant endpoint using POST withContent-Type: application/json, this adds an attribute q with an object value to the core JSON search request body.
76+
When calling the relevant endpoint using `POST` with `Content-Type: application/json`, this adds an attribute `q` with an object value to the core JSON search request body.
3977

4078
The syntax for the q attribute is:
4179

0 commit comments

Comments
 (0)