Repository: Informasjonsforvaltning/fdk-fulltext-search

Issue:
Last x days filter is not including current day
Filter range should add an extra day

Discussion:
NilsOveTen: Tipper det bare er å legge til `+1d` i expected for testene som feiler

Patch:
diff --git a/src/fdk_fulltext_search/search/query_filter_utils.py b/src/fdk_fulltext_search/search/query_filter_utils.py
index b6b0f24..0a786d5 100644
--- a/src/fdk_fulltext_search/search/query_filter_utils.py
+++ b/src/fdk_fulltext_search/search/query_filter_utils.py
@@ -68,7 +68,7 @@ def exists_filter(request_item):
 
 def last_x_days_filter(request_item):
     range_str = f"now-{request_item['last_x_days']}d/d"
-    return {"range": {"harvest.firstHarvested": {"gte": range_str, "lt": "now/d"}}}
+    return {"range": {"harvest.firstHarvested": {"gte": range_str, "lt": "now+1d/d"}}}
 
 
 def catalogs_by_name_filter(cat_name):


Test patch:
diff --git a/tests/test_queries.py b/tests/test_queries.py
index 4ac613e..99d88b6 100644
--- a/tests/test_queries.py
+++ b/tests/test_queries.py
@@ -1827,7 +1827,7 @@ def test_add_filter_should_add_x_last_days_filter():
     has_x_last_days = False
     for f in builder.body["query"]["bool"]["filter"]:
         if f == {
-            "range": {"harvest.firstHarvested": {"gte": "now-6d/d", "lt": "now/d"}}
+            "range": {"harvest.firstHarvested": {"gte": "now-6d/d", "lt": "now+1d/d"}}
         }:
             has_x_last_days = True
             break
diff --git a/tests/test_query_utils.py b/tests/test_query_utils.py
index 3f7ccfc..ccec6bd 100644
--- a/tests/test_query_utils.py
+++ b/tests/test_query_utils.py
@@ -687,13 +687,13 @@ def test_get_aggregation_term_for_key():
 
 def test_last_x_days_filter():
     expected_1 = {
-        "range": {"harvest.firstHarvested": {"gte": "now-3d/d", "lt": "now/d"}}
+        "range": {"harvest.firstHarvested": {"gte": "now-3d/d", "lt": "now+1d/d"}}
     }
     result_1 = last_x_days_filter({"last_x_days": 3})
     assert result_1 == expected_1
 
     expected_2 = {
-        "range": {"harvest.firstHarvested": {"gte": "now-672d/d", "lt": "now/d"}}
+        "range": {"harvest.firstHarvested": {"gte": "now-672d/d", "lt": "now+1d/d"}}
     }
     result_2 = last_x_days_filter({"last_x_days": "672"})
     assert result_2 == expected_2