Skip to content

Commit a4720d2

Browse files
committed
min should match, refresh
1 parent 9ac4465 commit a4720d2

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

stac_fastapi/sfeos_helpers/stac_fastapi/sfeos_helpers/filter/transform.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ def to_es(queryables_mapping: Dict[str, Any], query: Dict[str, Any]) -> Dict[str
5050
]
5151
}
5252
}
53-
# # Add minimum_should_match for OR conditions
54-
# if query["op"] == LogicalOp.OR:
55-
# bool_query["bool"]["minimum_should_match"] = 1
53+
# Add minimum_should_match for OR conditions
54+
if query["op"] == LogicalOp.OR:
55+
bool_query["bool"]["minimum_should_match"] = 1
5656

5757
return bool_query
5858

stac_fastapi/tests/extensions/test_filter.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -677,11 +677,21 @@ async def test_queryables_enum_platform(
677677

678678

679679
@pytest.mark.asyncio
680-
async def test_search_filter_ext_or_with_must_condition(app_client, load_test_data):
680+
async def test_search_filter_ext_or_with_must_condition(
681+
app_client,
682+
load_test_data,
683+
monkeypatch: pytest.MonkeyPatch,
684+
):
681685
"""
682686
Test that OR conditions require at least one match when combined with MUST.
683687
This test will fail if minimum_should_match=1 is not set in the ES/OS query.
684688
"""
689+
690+
# Arrange
691+
# Enforce instant database refresh
692+
# TODO: Is there a better way to do this?
693+
monkeypatch.setenv("DATABASE_REFRESH", "true")
694+
685695
# Arrange: Create a unique collection for this test
686696
collection_data = load_test_data("test_collection.json")
687697
collection_id = collection_data["id"] = f"or-test-collection-{uuid.uuid4()}"

0 commit comments

Comments
 (0)