sfeos-helpers 6.3.0__py3-none-any.whl → 6.4.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {sfeos_helpers-6.3.0.dist-info → sfeos_helpers-6.4.0.dist-info}/METADATA +41 -4
- {sfeos_helpers-6.3.0.dist-info → sfeos_helpers-6.4.0.dist-info}/RECORD +7 -7
- stac_fastapi/sfeos_helpers/filter/client.py +6 -3
- stac_fastapi/sfeos_helpers/mappings.py +2 -0
- stac_fastapi/sfeos_helpers/version.py +1 -1
- {sfeos_helpers-6.3.0.dist-info → sfeos_helpers-6.4.0.dist-info}/WHEEL +0 -0
- {sfeos_helpers-6.3.0.dist-info → sfeos_helpers-6.4.0.dist-info}/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: sfeos-helpers
|
|
3
|
-
Version: 6.
|
|
3
|
+
Version: 6.4.0
|
|
4
4
|
Summary: Helper library for the Elasticsearch and Opensearch stac-fastapi backends.
|
|
5
5
|
Home-page: https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch
|
|
6
6
|
License: MIT
|
|
@@ -15,7 +15,7 @@ Classifier: Programming Language :: Python :: 3.13
|
|
|
15
15
|
Classifier: License :: OSI Approved :: MIT License
|
|
16
16
|
Requires-Python: >=3.9
|
|
17
17
|
Description-Content-Type: text/markdown
|
|
18
|
-
Requires-Dist: stac-fastapi.core==6.
|
|
18
|
+
Requires-Dist: stac-fastapi.core==6.4.0
|
|
19
19
|
|
|
20
20
|
# stac-fastapi-elasticsearch-opensearch
|
|
21
21
|
|
|
@@ -55,11 +55,10 @@ SFEOS (stac-fastapi-elasticsearch-opensearch) is a high-performance, scalable AP
|
|
|
55
55
|
- **Scale to millions of geospatial assets** with fast search performance through optimized spatial indexing and query capabilities
|
|
56
56
|
- **Support OGC-compliant filtering** including spatial operations (intersects, contains, etc.) and temporal queries
|
|
57
57
|
- **Perform geospatial aggregations** to analyze data distribution across space and time
|
|
58
|
+
- **Enhanced collection search capabilities** with support for sorting and field selection
|
|
58
59
|
|
|
59
60
|
This implementation builds on the STAC-FastAPI framework, providing a production-ready solution specifically optimized for Elasticsearch and OpenSearch databases. It's ideal for organizations managing large geospatial data catalogs who need efficient discovery and access capabilities through standardized APIs.
|
|
60
61
|
|
|
61
|
-
|
|
62
|
-
|
|
63
62
|
## Common Deployment Patterns
|
|
64
63
|
|
|
65
64
|
stac-fastapi-elasticsearch-opensearch can be deployed in several ways depending on your needs:
|
|
@@ -91,6 +90,7 @@ This project is built on the following technologies: STAC, stac-fastapi, FastAPI
|
|
|
91
90
|
- [Common Deployment Patterns](#common-deployment-patterns)
|
|
92
91
|
- [Technologies](#technologies)
|
|
93
92
|
- [Table of Contents](#table-of-contents)
|
|
93
|
+
- [Collection Search Extensions](#collection-search-extensions)
|
|
94
94
|
- [Documentation \& Resources](#documentation--resources)
|
|
95
95
|
- [Package Structure](#package-structure)
|
|
96
96
|
- [Examples](#examples)
|
|
@@ -132,6 +132,37 @@ This project is built on the following technologies: STAC, stac-fastapi, FastAPI
|
|
|
132
132
|
- [Gitter Chat](https://app.gitter.im/#/room/#stac-fastapi-elasticsearch_community:gitter.im) - For real-time discussions
|
|
133
133
|
- [GitHub Discussions](https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/discussions) - For longer-form questions and answers
|
|
134
134
|
|
|
135
|
+
## Collection Search Extensions
|
|
136
|
+
|
|
137
|
+
SFEOS implements extended capabilities for the `/collections` endpoint, allowing for more powerful collection discovery:
|
|
138
|
+
|
|
139
|
+
- **Sorting**: Sort collections by sortable fields using the `sortby` parameter
|
|
140
|
+
- Example: `/collections?sortby=+id` (ascending sort by ID)
|
|
141
|
+
- Example: `/collections?sortby=-id` (descending sort by ID)
|
|
142
|
+
- Example: `/collections?sortby=-temporal` (descending sort by temporal extent)
|
|
143
|
+
|
|
144
|
+
- **Field Selection**: Request only specific fields to be returned using the `fields` parameter
|
|
145
|
+
- Example: `/collections?fields=id,title,description`
|
|
146
|
+
- This helps reduce payload size when only certain fields are needed
|
|
147
|
+
|
|
148
|
+
- **Free Text Search**: Search across collection text fields using the `q` parameter
|
|
149
|
+
- Example: `/collections?q=landsat`
|
|
150
|
+
- Searches across multiple text fields including title, description, and keywords
|
|
151
|
+
- Supports partial word matching and relevance-based sorting
|
|
152
|
+
|
|
153
|
+
These extensions make it easier to build user interfaces that display and navigate through collections efficiently.
|
|
154
|
+
|
|
155
|
+
> **Configuration**: Collection search extensions can be disabled by setting the `ENABLE_COLLECTIONS_SEARCH` environment variable to `false`. By default, these extensions are enabled.
|
|
156
|
+
|
|
157
|
+
> **Note**: Sorting is only available on fields that are indexed for sorting in Elasticsearch/OpenSearch. With the default mappings, you can sort on:
|
|
158
|
+
> - `id` (keyword field)
|
|
159
|
+
> - `extent.temporal.interval` (date field)
|
|
160
|
+
> - `temporal` (alias to extent.temporal.interval)
|
|
161
|
+
>
|
|
162
|
+
> Text fields like `title` and `description` are not sortable by default as they use text analysis for better search capabilities. Attempting to sort on these fields will result in a user-friendly error message explaining which fields are sortable and how to make additional fields sortable by updating the mappings.
|
|
163
|
+
>
|
|
164
|
+
> **Important**: Adding keyword fields to make text fields sortable can significantly increase the index size, especially for large text fields. Consider the storage implications when deciding which fields to make sortable.
|
|
165
|
+
|
|
135
166
|
## Package Structure
|
|
136
167
|
|
|
137
168
|
This project is organized into several packages, each with a specific purpose:
|
|
@@ -262,10 +293,12 @@ You can customize additional settings in your `.env` file:
|
|
|
262
293
|
| `ENABLE_DIRECT_RESPONSE` | Enable direct response for maximum performance (disables all FastAPI dependencies, including authentication, custom status codes, and validation) | `false` | Optional |
|
|
263
294
|
| `RAISE_ON_BULK_ERROR` | Controls whether bulk insert operations raise exceptions on errors. If set to `true`, the operation will stop and raise an exception when an error occurs. If set to `false`, errors will be logged, and the operation will continue. **Note:** STAC Item and ItemCollection validation errors will always raise, regardless of this flag. | `false` | Optional |
|
|
264
295
|
| `DATABASE_REFRESH` | Controls whether database operations refresh the index immediately after changes. If set to `true`, changes will be immediately searchable. If set to `false`, changes may not be immediately visible but can improve performance for bulk operations. If set to `wait_for`, changes will wait for the next refresh cycle to become visible. | `false` | Optional |
|
|
296
|
+
| `ENABLE_COLLECTIONS_SEARCH` | Enable collection search extensions (sort, fields). | `true` | Optional |
|
|
265
297
|
| `ENABLE_TRANSACTIONS_EXTENSIONS` | Enables or disables the Transactions and Bulk Transactions API extensions. If set to `false`, the POST `/collections` route and related transaction endpoints (including bulk transaction operations) will be unavailable in the API. This is useful for deployments where mutating the catalog via the API should be prevented. | `true` | Optional |
|
|
266
298
|
| `STAC_ITEM_LIMIT` | Sets the environment variable for result limiting to SFEOS for the number of returned items and STAC collections. | `10` | Optional |
|
|
267
299
|
| `STAC_INDEX_ASSETS` | Controls if Assets are indexed when added to Elasticsearch/Opensearch. This allows asset fields to be included in search queries. | `false` | Optional |
|
|
268
300
|
| `ENV_MAX_LIMIT` | Configures the environment variable in SFEOS to override the default `MAX_LIMIT`, which controls the limit parameter for returned items and STAC collections. | `10,000` | Optional |
|
|
301
|
+
| `USE_DATETIME` | Configures the datetime search behavior in SFEOS. When enabled, searches both datetime field and falls back to start_datetime/end_datetime range for items with null datetime. When disabled, searches only by start_datetime/end_datetime range. | True | Optional |
|
|
269
302
|
|
|
270
303
|
> [!NOTE]
|
|
271
304
|
> The variables `ES_HOST`, `ES_PORT`, `ES_USE_SSL`, `ES_VERIFY_CERTS` and `ES_TIMEOUT` apply to both Elasticsearch and OpenSearch backends, so there is no need to rename the key names to `OS_` even if you're using OpenSearch.
|
|
@@ -407,6 +440,10 @@ The system uses a precise naming convention:
|
|
|
407
440
|
- **Root Path Configuration**: The application root path is the base URL by default.
|
|
408
441
|
- For AWS Lambda with Gateway API: Set `STAC_FASTAPI_ROOT_PATH` to match the Gateway API stage name (e.g., `/v1`)
|
|
409
442
|
|
|
443
|
+
- **Feature Configuration**: Control which features are enabled:
|
|
444
|
+
- `ENABLE_COLLECTIONS_SEARCH`: Set to `true` (default) to enable collection search extensions (sort, fields). Set to `false` to disable.
|
|
445
|
+
- `ENABLE_TRANSACTIONS_EXTENSIONS`: Set to `true` (default) to enable transaction extensions. Set to `false` to disable.
|
|
446
|
+
|
|
410
447
|
|
|
411
448
|
## Collection Pagination
|
|
412
449
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
stac_fastapi/sfeos_helpers/mappings.py,sha256=
|
|
2
|
-
stac_fastapi/sfeos_helpers/version.py,sha256=
|
|
1
|
+
stac_fastapi/sfeos_helpers/mappings.py,sha256=4IrI46_DRUeyry_rim2D7LnHnwQgUvMRDMnDs0Q1q14,8512
|
|
2
|
+
stac_fastapi/sfeos_helpers/version.py,sha256=1xfRb7s1Stv055oEewNJpZn9OQUUcaJvgSzCsYLHYSQ,45
|
|
3
3
|
stac_fastapi/sfeos_helpers/aggregation/__init__.py,sha256=Mym17lFh90by1GnoQgMyIKAqRNJnvCgVSXDYzjBiPQk,1210
|
|
4
4
|
stac_fastapi/sfeos_helpers/aggregation/client.py,sha256=PPUk0kAZnms46FlLGrR5w8wa52vG-dT6BG37896R5CY,17939
|
|
5
5
|
stac_fastapi/sfeos_helpers/aggregation/format.py,sha256=qUW1jjh2EEjy-V7riliFR77grpi-AgsTmP76z60K5Lo,2011
|
|
@@ -11,7 +11,7 @@ stac_fastapi/sfeos_helpers/database/mapping.py,sha256=4-MSd4xH5wg7yoC4aPjzYMDSEv
|
|
|
11
11
|
stac_fastapi/sfeos_helpers/database/query.py,sha256=g2iGdfgqpx6o8GoQJBMl3AMmqcbSf792qvKWfWipR5w,4193
|
|
12
12
|
stac_fastapi/sfeos_helpers/database/utils.py,sha256=9zU9hEglZb6f-uxOhd95saSw2id9w5PR36dWtyfXTb0,8757
|
|
13
13
|
stac_fastapi/sfeos_helpers/filter/__init__.py,sha256=n3zL_MhEGOoxMz1KeijyK_UKiZ0MKPl90zHtYI5RAy8,1557
|
|
14
|
-
stac_fastapi/sfeos_helpers/filter/client.py,sha256=
|
|
14
|
+
stac_fastapi/sfeos_helpers/filter/client.py,sha256=tCfqI2IBgJKF0U_0yuxjiSDLBllCqNCMcHASP4-icsA,4348
|
|
15
15
|
stac_fastapi/sfeos_helpers/filter/cql2.py,sha256=Cg9kRYD9CVkVSyRqOyB5oVXmlyteSn2bw88sqklGpUM,955
|
|
16
16
|
stac_fastapi/sfeos_helpers/filter/transform.py,sha256=1GEWQSp-rbq7_1nDVv1ApDbWxt8DswJWxwaxzV85gj4,4644
|
|
17
17
|
stac_fastapi/sfeos_helpers/models/patch.py,sha256=s5n85ktnH6M2SMqpqyItR8uLxliXmnSTg1WO0QLVsmI,3127
|
|
@@ -26,7 +26,7 @@ stac_fastapi/sfeos_helpers/search_engine/selection/base.py,sha256=106c4FK50cgMmT
|
|
|
26
26
|
stac_fastapi/sfeos_helpers/search_engine/selection/cache_manager.py,sha256=5yrgf9JA4mgRNMPDKih6xySF8mD724lEWnXhWud7m2c,4039
|
|
27
27
|
stac_fastapi/sfeos_helpers/search_engine/selection/factory.py,sha256=vbgNVCUW2lviePqzpgsPLxp6IEqcX3GHiahqN2oVObA,1305
|
|
28
28
|
stac_fastapi/sfeos_helpers/search_engine/selection/selectors.py,sha256=q83nfCfNfLUqtkHpORwNHNRU9Pa-heeaDIPO0RlHb-8,4779
|
|
29
|
-
sfeos_helpers-6.
|
|
30
|
-
sfeos_helpers-6.
|
|
31
|
-
sfeos_helpers-6.
|
|
32
|
-
sfeos_helpers-6.
|
|
29
|
+
sfeos_helpers-6.4.0.dist-info/METADATA,sha256=4sXPxujytzGybiTskfZKq3E3HO9HaZriDLuw0FUypgE,38928
|
|
30
|
+
sfeos_helpers-6.4.0.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
|
|
31
|
+
sfeos_helpers-6.4.0.dist-info/top_level.txt,sha256=vqn-D9-HsRPTTxy0Vk_KkDmTiMES4owwBQ3ydSZYb2s,13
|
|
32
|
+
sfeos_helpers-6.4.0.dist-info/RECORD,,
|
|
@@ -4,6 +4,7 @@ from collections import deque
|
|
|
4
4
|
from typing import Any, Dict, Optional, Tuple
|
|
5
5
|
|
|
6
6
|
import attr
|
|
7
|
+
from fastapi import Request
|
|
7
8
|
|
|
8
9
|
from stac_fastapi.core.base_database_logic import BaseDatabaseLogic
|
|
9
10
|
from stac_fastapi.core.extensions.filter import ALL_QUERYABLES, DEFAULT_QUERYABLES
|
|
@@ -37,9 +38,11 @@ class EsAsyncBaseFiltersClient(AsyncBaseFiltersClient):
|
|
|
37
38
|
Returns:
|
|
38
39
|
Dict[str, Any]: A dictionary containing the queryables for the given collection.
|
|
39
40
|
"""
|
|
41
|
+
request: Optional[Request] = kwargs.get("request")
|
|
42
|
+
url_str: str = str(request.url) if request else ""
|
|
40
43
|
queryables: Dict[str, Any] = {
|
|
41
|
-
"$schema": "https://json-schema.org/draft
|
|
42
|
-
"$id": "
|
|
44
|
+
"$schema": "https://json-schema.org/draft-07/schema",
|
|
45
|
+
"$id": f"{url_str}",
|
|
43
46
|
"type": "object",
|
|
44
47
|
"title": "Queryables for STAC API",
|
|
45
48
|
"description": "Queryable names for the STAC API Item Search filter.",
|
|
@@ -49,7 +52,7 @@ class EsAsyncBaseFiltersClient(AsyncBaseFiltersClient):
|
|
|
49
52
|
if not collection_id:
|
|
50
53
|
return queryables
|
|
51
54
|
|
|
52
|
-
properties: Dict[str, Any] = queryables["properties"]
|
|
55
|
+
properties: Dict[str, Any] = queryables["properties"].copy()
|
|
53
56
|
queryables.update(
|
|
54
57
|
{
|
|
55
58
|
"properties": properties,
|
|
@@ -165,6 +165,8 @@ ES_COLLECTIONS_MAPPINGS = {
|
|
|
165
165
|
"providers": {"type": "object", "enabled": False},
|
|
166
166
|
"links": {"type": "object", "enabled": False},
|
|
167
167
|
"item_assets": {"type": "object", "enabled": get_bool_env("STAC_INDEX_ASSETS")},
|
|
168
|
+
# Field alias to allow sorting on 'temporal' (points to extent.temporal.interval)
|
|
169
|
+
"temporal": {"type": "alias", "path": "extent.temporal.interval"},
|
|
168
170
|
},
|
|
169
171
|
}
|
|
170
172
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"""library version."""
|
|
2
|
-
__version__ = "6.
|
|
2
|
+
__version__ = "6.4.0"
|
|
File without changes
|
|
File without changes
|