stac-fastapi.core 3.2.2__tar.gz → 3.2.3__tar.gz

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.
Files changed (30) hide show
  1. {stac_fastapi.core-3.2.2 → stac_fastapi.core-3.2.3}/PKG-INFO +7 -7
  2. {stac_fastapi.core-3.2.2 → stac_fastapi.core-3.2.3}/README.md +6 -6
  3. {stac_fastapi.core-3.2.2 → stac_fastapi.core-3.2.3}/setup.py +1 -1
  4. {stac_fastapi.core-3.2.2 → stac_fastapi.core-3.2.3}/stac_fastapi/core/extensions/filter.py +22 -10
  5. {stac_fastapi.core-3.2.2 → stac_fastapi.core-3.2.3}/stac_fastapi/core/version.py +1 -1
  6. {stac_fastapi.core-3.2.2 → stac_fastapi.core-3.2.3}/stac_fastapi.core.egg-info/PKG-INFO +7 -7
  7. {stac_fastapi.core-3.2.2 → stac_fastapi.core-3.2.3}/stac_fastapi.core.egg-info/requires.txt +1 -1
  8. {stac_fastapi.core-3.2.2 → stac_fastapi.core-3.2.3}/setup.cfg +0 -0
  9. {stac_fastapi.core-3.2.2 → stac_fastapi.core-3.2.3}/stac_fastapi/core/__init__.py +0 -0
  10. {stac_fastapi.core-3.2.2 → stac_fastapi.core-3.2.3}/stac_fastapi/core/base_database_logic.py +0 -0
  11. {stac_fastapi.core-3.2.2 → stac_fastapi.core-3.2.3}/stac_fastapi/core/base_settings.py +0 -0
  12. {stac_fastapi.core-3.2.2 → stac_fastapi.core-3.2.3}/stac_fastapi/core/basic_auth.py +0 -0
  13. {stac_fastapi.core-3.2.2 → stac_fastapi.core-3.2.3}/stac_fastapi/core/core.py +0 -0
  14. {stac_fastapi.core-3.2.2 → stac_fastapi.core-3.2.3}/stac_fastapi/core/datetime_utils.py +0 -0
  15. {stac_fastapi.core-3.2.2 → stac_fastapi.core-3.2.3}/stac_fastapi/core/extensions/__init__.py +0 -0
  16. {stac_fastapi.core-3.2.2 → stac_fastapi.core-3.2.3}/stac_fastapi/core/extensions/aggregation.py +0 -0
  17. {stac_fastapi.core-3.2.2 → stac_fastapi.core-3.2.3}/stac_fastapi/core/extensions/fields.py +0 -0
  18. {stac_fastapi.core-3.2.2 → stac_fastapi.core-3.2.3}/stac_fastapi/core/extensions/query.py +0 -0
  19. {stac_fastapi.core-3.2.2 → stac_fastapi.core-3.2.3}/stac_fastapi/core/models/__init__.py +0 -0
  20. {stac_fastapi.core-3.2.2 → stac_fastapi.core-3.2.3}/stac_fastapi/core/models/links.py +0 -0
  21. {stac_fastapi.core-3.2.2 → stac_fastapi.core-3.2.3}/stac_fastapi/core/models/search.py +0 -0
  22. {stac_fastapi.core-3.2.2 → stac_fastapi.core-3.2.3}/stac_fastapi/core/rate_limit.py +0 -0
  23. {stac_fastapi.core-3.2.2 → stac_fastapi.core-3.2.3}/stac_fastapi/core/route_dependencies.py +0 -0
  24. {stac_fastapi.core-3.2.2 → stac_fastapi.core-3.2.3}/stac_fastapi/core/serializers.py +0 -0
  25. {stac_fastapi.core-3.2.2 → stac_fastapi.core-3.2.3}/stac_fastapi/core/session.py +0 -0
  26. {stac_fastapi.core-3.2.2 → stac_fastapi.core-3.2.3}/stac_fastapi/core/utilities.py +0 -0
  27. {stac_fastapi.core-3.2.2 → stac_fastapi.core-3.2.3}/stac_fastapi.core.egg-info/SOURCES.txt +0 -0
  28. {stac_fastapi.core-3.2.2 → stac_fastapi.core-3.2.3}/stac_fastapi.core.egg-info/dependency_links.txt +0 -0
  29. {stac_fastapi.core-3.2.2 → stac_fastapi.core-3.2.3}/stac_fastapi.core.egg-info/not-zip-safe +0 -0
  30. {stac_fastapi.core-3.2.2 → stac_fastapi.core-3.2.3}/stac_fastapi.core.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: stac_fastapi.core
3
- Version: 3.2.2
3
+ Version: 3.2.3
4
4
  Summary: Core 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
@@ -285,17 +285,17 @@ A reindex operation might be useful to apply changes to documents or to correct
285
285
 
286
286
  The index templates will make sure that manually created indices will also have the correct mappings and settings.
287
287
 
288
- In this example, we will make a copy of an existing Item index `items_my-collection-000001` but change the Item identifier to be lowercase.
288
+ In this example, we will make a copy of an existing Item index `items_my-collection-lower_my-collection-hex-000001` but change the Item identifier to be lowercase.
289
289
 
290
290
  ```shell
291
291
  curl -X "POST" "http://localhost:9200/_reindex" \
292
292
  -H 'Content-Type: application/json' \
293
293
  -d $'{
294
294
  "source": {
295
- "index": "items_my-collection-000001"
295
+ "index": "items_my-collection-lower_my-collection-hex-000001"
296
296
  },
297
297
  "dest": {
298
- "index": "items_my-collection-000002"
298
+ "index": "items_my-collection-lower_my-collection-hex-000002"
299
299
  },
300
300
  "script": {
301
301
  "source": "ctx._source.id = ctx._source.id.toLowerCase()",
@@ -304,7 +304,7 @@ curl -X "POST" "http://localhost:9200/_reindex" \
304
304
  }'
305
305
  ```
306
306
 
307
- If we are happy with the data in the newly created index, we can move the alias `items_my-collection` to the new index `items_my-collection-000002`.
307
+ If we are happy with the data in the newly created index, we can move the alias `items_my-collection` to the new index `items_my-collection-lower_my-collection-hex-000002`.
308
308
  ```shell
309
309
  curl -X "POST" "http://localhost:9200/_aliases" \
310
310
  -h 'Content-Type: application/json' \
@@ -318,7 +318,7 @@ curl -X "POST" "http://localhost:9200/_aliases" \
318
318
  },
319
319
  {
320
320
  "add": {
321
- "index": "items_my-collection-000002",
321
+ "index": "items_my-collection-lower_my-collection-hex-000002",
322
322
  "alias": "items_my-collection"
323
323
  }
324
324
  }
@@ -335,7 +335,7 @@ Authentication is an optional feature that can be enabled through `Route Depende
335
335
 
336
336
  ## Aggregation
337
337
 
338
- Aggregation of points and geometries, as well as frequency distribution aggregation of any other property including dates is supported in stac-fatsapi-elasticsearch-opensearch. Aggregations can be defined at the root Catalog level (`/aggregations`) and at the Collection level (`/<collection_id>/aggregations`). Details for supported aggregations can be found at [./docs/src/aggregation.md](./docs/src/aggregation.md)
338
+ Aggregation of points and geometries, as well as frequency distribution aggregation of any other property including dates is supported in stac-fatsapi-elasticsearch-opensearch. Aggregations can be defined at the root Catalog level (`/aggregations`) and at the Collection level (`/<collection_id>/aggregations`). Details for supported aggregations can be found in [the aggregation docs](./docs/src/aggregation.md)
339
339
 
340
340
  ## Rate Limiting
341
341
 
@@ -267,17 +267,17 @@ A reindex operation might be useful to apply changes to documents or to correct
267
267
 
268
268
  The index templates will make sure that manually created indices will also have the correct mappings and settings.
269
269
 
270
- In this example, we will make a copy of an existing Item index `items_my-collection-000001` but change the Item identifier to be lowercase.
270
+ In this example, we will make a copy of an existing Item index `items_my-collection-lower_my-collection-hex-000001` but change the Item identifier to be lowercase.
271
271
 
272
272
  ```shell
273
273
  curl -X "POST" "http://localhost:9200/_reindex" \
274
274
  -H 'Content-Type: application/json' \
275
275
  -d $'{
276
276
  "source": {
277
- "index": "items_my-collection-000001"
277
+ "index": "items_my-collection-lower_my-collection-hex-000001"
278
278
  },
279
279
  "dest": {
280
- "index": "items_my-collection-000002"
280
+ "index": "items_my-collection-lower_my-collection-hex-000002"
281
281
  },
282
282
  "script": {
283
283
  "source": "ctx._source.id = ctx._source.id.toLowerCase()",
@@ -286,7 +286,7 @@ curl -X "POST" "http://localhost:9200/_reindex" \
286
286
  }'
287
287
  ```
288
288
 
289
- If we are happy with the data in the newly created index, we can move the alias `items_my-collection` to the new index `items_my-collection-000002`.
289
+ If we are happy with the data in the newly created index, we can move the alias `items_my-collection` to the new index `items_my-collection-lower_my-collection-hex-000002`.
290
290
  ```shell
291
291
  curl -X "POST" "http://localhost:9200/_aliases" \
292
292
  -h 'Content-Type: application/json' \
@@ -300,7 +300,7 @@ curl -X "POST" "http://localhost:9200/_aliases" \
300
300
  },
301
301
  {
302
302
  "add": {
303
- "index": "items_my-collection-000002",
303
+ "index": "items_my-collection-lower_my-collection-hex-000002",
304
304
  "alias": "items_my-collection"
305
305
  }
306
306
  }
@@ -317,7 +317,7 @@ Authentication is an optional feature that can be enabled through `Route Depende
317
317
 
318
318
  ## Aggregation
319
319
 
320
- Aggregation of points and geometries, as well as frequency distribution aggregation of any other property including dates is supported in stac-fatsapi-elasticsearch-opensearch. Aggregations can be defined at the root Catalog level (`/aggregations`) and at the Collection level (`/<collection_id>/aggregations`). Details for supported aggregations can be found at [./docs/src/aggregation.md](./docs/src/aggregation.md)
320
+ Aggregation of points and geometries, as well as frequency distribution aggregation of any other property including dates is supported in stac-fatsapi-elasticsearch-opensearch. Aggregations can be defined at the root Catalog level (`/aggregations`) and at the Collection level (`/<collection_id>/aggregations`). Details for supported aggregations can be found in [the aggregation docs](./docs/src/aggregation.md)
321
321
 
322
322
  ## Rate Limiting
323
323
 
@@ -16,7 +16,7 @@ install_requires = [
16
16
  "orjson",
17
17
  "overrides",
18
18
  "geojson-pydantic",
19
- "pygeofilter==0.2.1",
19
+ "pygeofilter==0.3.1",
20
20
  "typing_extensions==4.8.0",
21
21
  "jsonschema",
22
22
  "slowapi==0.1.9",
@@ -140,26 +140,38 @@ def to_es(query: Dict[str, Any]) -> Dict[str, Any]:
140
140
  ComparisonOp.GT,
141
141
  ComparisonOp.GTE,
142
142
  ]:
143
+ range_op = {
144
+ ComparisonOp.LT: "lt",
145
+ ComparisonOp.LTE: "lte",
146
+ ComparisonOp.GT: "gt",
147
+ ComparisonOp.GTE: "gte",
148
+ }
149
+
143
150
  field = to_es_field(query["args"][0]["property"])
144
151
  value = query["args"][1]
145
152
  if isinstance(value, dict) and "timestamp" in value:
146
- # Handle timestamp fields specifically
147
153
  value = value["timestamp"]
148
- if query["op"] == ComparisonOp.IS_NULL:
149
- return {"bool": {"must_not": {"exists": {"field": field}}}}
154
+ if query["op"] == ComparisonOp.EQ:
155
+ return {"range": {field: {"gte": value, "lte": value}}}
156
+ elif query["op"] == ComparisonOp.NEQ:
157
+ return {
158
+ "bool": {
159
+ "must_not": [{"range": {field: {"gte": value, "lte": value}}}]
160
+ }
161
+ }
162
+ else:
163
+ return {"range": {field: {range_op[query["op"]]: value}}}
150
164
  else:
151
165
  if query["op"] == ComparisonOp.EQ:
152
166
  return {"term": {field: value}}
153
167
  elif query["op"] == ComparisonOp.NEQ:
154
168
  return {"bool": {"must_not": [{"term": {field: value}}]}}
155
169
  else:
156
- range_op = {
157
- ComparisonOp.LT: "lt",
158
- ComparisonOp.LTE: "lte",
159
- ComparisonOp.GT: "gt",
160
- ComparisonOp.GTE: "gte",
161
- }[query["op"]]
162
- return {"range": {field: {range_op: value}}}
170
+ return {"range": {field: {range_op[query["op"]]: value}}}
171
+
172
+ elif query["op"] == ComparisonOp.IS_NULL:
173
+ field = to_es_field(query["args"][0]["property"])
174
+ return {"bool": {"must_not": {"exists": {"field": field}}}}
163
175
 
164
176
  elif query["op"] == AdvancedComparisonOp.BETWEEN:
165
177
  field = to_es_field(query["args"][0]["property"])
@@ -1,2 +1,2 @@
1
1
  """library version."""
2
- __version__ = "3.2.2"
2
+ __version__ = "3.2.3"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: stac-fastapi.core
3
- Version: 3.2.2
3
+ Version: 3.2.3
4
4
  Summary: Core 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
@@ -285,17 +285,17 @@ A reindex operation might be useful to apply changes to documents or to correct
285
285
 
286
286
  The index templates will make sure that manually created indices will also have the correct mappings and settings.
287
287
 
288
- In this example, we will make a copy of an existing Item index `items_my-collection-000001` but change the Item identifier to be lowercase.
288
+ In this example, we will make a copy of an existing Item index `items_my-collection-lower_my-collection-hex-000001` but change the Item identifier to be lowercase.
289
289
 
290
290
  ```shell
291
291
  curl -X "POST" "http://localhost:9200/_reindex" \
292
292
  -H 'Content-Type: application/json' \
293
293
  -d $'{
294
294
  "source": {
295
- "index": "items_my-collection-000001"
295
+ "index": "items_my-collection-lower_my-collection-hex-000001"
296
296
  },
297
297
  "dest": {
298
- "index": "items_my-collection-000002"
298
+ "index": "items_my-collection-lower_my-collection-hex-000002"
299
299
  },
300
300
  "script": {
301
301
  "source": "ctx._source.id = ctx._source.id.toLowerCase()",
@@ -304,7 +304,7 @@ curl -X "POST" "http://localhost:9200/_reindex" \
304
304
  }'
305
305
  ```
306
306
 
307
- If we are happy with the data in the newly created index, we can move the alias `items_my-collection` to the new index `items_my-collection-000002`.
307
+ If we are happy with the data in the newly created index, we can move the alias `items_my-collection` to the new index `items_my-collection-lower_my-collection-hex-000002`.
308
308
  ```shell
309
309
  curl -X "POST" "http://localhost:9200/_aliases" \
310
310
  -h 'Content-Type: application/json' \
@@ -318,7 +318,7 @@ curl -X "POST" "http://localhost:9200/_aliases" \
318
318
  },
319
319
  {
320
320
  "add": {
321
- "index": "items_my-collection-000002",
321
+ "index": "items_my-collection-lower_my-collection-hex-000002",
322
322
  "alias": "items_my-collection"
323
323
  }
324
324
  }
@@ -335,7 +335,7 @@ Authentication is an optional feature that can be enabled through `Route Depende
335
335
 
336
336
  ## Aggregation
337
337
 
338
- Aggregation of points and geometries, as well as frequency distribution aggregation of any other property including dates is supported in stac-fatsapi-elasticsearch-opensearch. Aggregations can be defined at the root Catalog level (`/aggregations`) and at the Collection level (`/<collection_id>/aggregations`). Details for supported aggregations can be found at [./docs/src/aggregation.md](./docs/src/aggregation.md)
338
+ Aggregation of points and geometries, as well as frequency distribution aggregation of any other property including dates is supported in stac-fatsapi-elasticsearch-opensearch. Aggregations can be defined at the root Catalog level (`/aggregations`) and at the Collection level (`/<collection_id>/aggregations`). Details for supported aggregations can be found in [the aggregation docs](./docs/src/aggregation.md)
339
339
 
340
340
  ## Rate Limiting
341
341
 
@@ -8,7 +8,7 @@ stac-fastapi.extensions==3.0.0
8
8
  orjson
9
9
  overrides
10
10
  geojson-pydantic
11
- pygeofilter==0.2.1
11
+ pygeofilter==0.3.1
12
12
  typing_extensions==4.8.0
13
13
  jsonschema
14
14
  slowapi==0.1.9