Skip to content

Commit b9a36e4

Browse files
committed
clean up test
1 parent e7edc9e commit b9a36e4

File tree

3 files changed

+8
-87
lines changed

3 files changed

+8
-87
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
99

1010
### Added
1111

12+
- GET `/collections` collection search free text extension ex. `/collections?q=sentinel`. [#466](https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/pull/466)
1213
- Added `USE_DATETIME` environment variable to configure datetime search behavior in SFEOS. [#452](https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/pull/452)
1314
- GET `/collections` collection search sort extension ex. `/collections?sortby=+id`. [#456](https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/pull/456)
1415
- GET `/collections` collection search fields extension ex. `/collections?fields=id,title`. [#465](https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/pull/465)

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,15 @@ SFEOS implements extended capabilities for the `/collections` endpoint, allowing
126126
- Example: `/collections?fields=id,title,description`
127127
- This helps reduce payload size when only certain fields are needed
128128

129+
- **Free Text Search**: Search across collection text fields using the `q` parameter
130+
- Example: `/collections?q=landsat`
131+
- Searches across multiple text fields including title, description, and keywords
132+
- Supports partial word matching and relevance-based sorting
133+
129134
These extensions make it easier to build user interfaces that display and navigate through collections efficiently.
130135

136+
> **Configuration**: Collection search extensions (sorting, field selection, and free text search) can be disabled by setting the `ENABLE_COLLECTIONS_SEARCH` environment variable to `false`. By default, these extensions are enabled.
137+
131138
> **Note**: Sorting is only available on fields that are indexed for sorting in Elasticsearch/OpenSearch. With the default mappings, you can sort on:
132139
> - `id` (keyword field)
133140
> - `extent.temporal.interval` (date field)

stac_fastapi/tests/api/test_api_search_collections.py

Lines changed: 0 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -226,90 +226,3 @@ async def test_collections_free_text_search_get(app_client, txn_client, load_tes
226226
# Should only find the landsat collection
227227
assert len(found_collections) == 1
228228
assert found_collections[0]["id"] == f"{test_prefix}-modis"
229-
230-
231-
# @pytest.mark.asyncio
232-
# async def test_collections_free_text_search_post(app_client, txn_client, load_test_data):
233-
# """Verify POST /collections-search honors the q parameter for free text search."""
234-
# # Create multiple collections with different content
235-
# base_collection = load_test_data("test_collection.json")
236-
237-
# # Use unique prefixes to avoid conflicts between tests
238-
# test_prefix = f"q-post-{uuid.uuid4().hex[:8]}"
239-
240-
# # Create collections with different content to test free text search
241-
# test_collections = [
242-
# {
243-
# "id": f"{test_prefix}-sentinel",
244-
# "title": "Sentinel-2 Collection",
245-
# "description": "Collection of Sentinel-2 data",
246-
# "summaries": {"platform": ["sentinel-2a", "sentinel-2b"]}
247-
# },
248-
# {
249-
# "id": f"{test_prefix}-landsat",
250-
# "title": "Landsat Collection",
251-
# "description": "Collection of Landsat data",
252-
# "summaries": {"platform": ["landsat-8", "landsat-9"]}
253-
# },
254-
# {
255-
# "id": f"{test_prefix}-modis",
256-
# "title": "MODIS Collection",
257-
# "description": "Collection of MODIS data",
258-
# "summaries": {"platform": ["terra", "aqua"]}
259-
# }
260-
# ]
261-
262-
# for i, coll in enumerate(test_collections):
263-
# test_collection = base_collection.copy()
264-
# test_collection["id"] = coll["id"]
265-
# test_collection["title"] = coll["title"]
266-
# test_collection["description"] = coll["description"]
267-
# test_collection["summaries"] = coll["summaries"]
268-
# await create_collection(txn_client, test_collection)
269-
270-
# # Test free text search for "sentinel" via POST
271-
# resp = await app_client.post(
272-
# "/collections-search",
273-
# json={"q": ["sentinel"]},
274-
# )
275-
# assert resp.status_code == 200
276-
# resp_json = resp.json()
277-
278-
# # Filter collections to only include the ones we created for this test
279-
# found_collections = [c for c in resp_json["collections"] if c["id"].startswith(test_prefix)]
280-
281-
# # Should only find the sentinel collection
282-
# assert len(found_collections) == 1
283-
# assert found_collections[0]["id"] == f"{test_prefix}-sentinel"
284-
285-
# # Test free text search for "landsat" via POST
286-
# resp = await app_client.post(
287-
# "/collections-search",
288-
# json={"q": ["landsat"]},
289-
# )
290-
# assert resp.status_code == 200
291-
# resp_json = resp.json()
292-
293-
# # Filter collections to only include the ones we created for this test
294-
# found_collections = [c for c in resp_json["collections"] if c["id"].startswith(test_prefix)]
295-
296-
# # Should only find the landsat collection
297-
# assert len(found_collections) == 1
298-
# assert found_collections[0]["id"] == f"{test_prefix}-landsat"
299-
300-
# # Test free text search with multiple terms
301-
# resp = await app_client.post(
302-
# "/collections-search",
303-
# json={"q": ["sentinel", "modis"]},
304-
# )
305-
# assert resp.status_code == 200
306-
# resp_json = resp.json()
307-
308-
# # Filter collections to only include the ones we created for this test
309-
# found_collections = [c for c in resp_json["collections"] if c["id"].startswith(test_prefix)]
310-
# found_ids = [c["id"] for c in found_collections]
311-
312-
# # Should find both sentinel and modis collections
313-
# assert len(found_collections) == 2
314-
# assert f"{test_prefix}-sentinel" in found_ids
315-
# assert f"{test_prefix}-modis" in found_ids

0 commit comments

Comments
 (0)