deepsights-api 1.2.3__tar.gz → 1.2.4__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 (81) hide show
  1. {deepsights_api-1.2.3 → deepsights_api-1.2.4}/CHANGELOG.md +5 -2
  2. {deepsights_api-1.2.3 → deepsights_api-1.2.4}/PKG-INFO +1 -1
  3. {deepsights_api-1.2.3 → deepsights_api-1.2.4}/deepsights/contentstore/resources/_search.py +23 -15
  4. {deepsights_api-1.2.3 → deepsights_api-1.2.4}/deepsights/contentstore/resources/news.py +3 -3
  5. {deepsights_api-1.2.3 → deepsights_api-1.2.4}/deepsights/contentstore/resources/secondary.py +3 -3
  6. {deepsights_api-1.2.3 → deepsights_api-1.2.4}/pyproject.toml +1 -1
  7. {deepsights_api-1.2.3 → deepsights_api-1.2.4}/tests/contentstore/test_news_search.py +20 -31
  8. {deepsights_api-1.2.3 → deepsights_api-1.2.4}/tests/contentstore/test_secondary_search.py +15 -24
  9. {deepsights_api-1.2.3 → deepsights_api-1.2.4}/tests/data/test_data.json +3 -3
  10. deepsights_api-1.2.4/uv.lock +584 -0
  11. deepsights_api-1.2.3/uv.lock +0 -248
  12. {deepsights_api-1.2.3 → deepsights_api-1.2.4}/.github/workflows/build_docs.yml +0 -0
  13. {deepsights_api-1.2.3 → deepsights_api-1.2.4}/.github/workflows/run_pylint.yml +0 -0
  14. {deepsights_api-1.2.3 → deepsights_api-1.2.4}/.github/workflows/run_tests.yml +0 -0
  15. {deepsights_api-1.2.3 → deepsights_api-1.2.4}/.gitignore +0 -0
  16. {deepsights_api-1.2.3 → deepsights_api-1.2.4}/.pylintrc +0 -0
  17. {deepsights_api-1.2.3 → deepsights_api-1.2.4}/.python-version +0 -0
  18. {deepsights_api-1.2.3 → deepsights_api-1.2.4}/.vscode/settings.json +0 -0
  19. {deepsights_api-1.2.3 → deepsights_api-1.2.4}/LICENSE +0 -0
  20. {deepsights_api-1.2.3 → deepsights_api-1.2.4}/README.md +0 -0
  21. {deepsights_api-1.2.3 → deepsights_api-1.2.4}/deepsights/__init__.py +0 -0
  22. {deepsights_api-1.2.3 → deepsights_api-1.2.4}/deepsights/api/__init__.py +0 -0
  23. {deepsights_api-1.2.3 → deepsights_api-1.2.4}/deepsights/api/api.py +0 -0
  24. {deepsights_api-1.2.3 → deepsights_api-1.2.4}/deepsights/api/resource.py +0 -0
  25. {deepsights_api-1.2.3 → deepsights_api-1.2.4}/deepsights/contentstore/__init__.py +0 -0
  26. {deepsights_api-1.2.3 → deepsights_api-1.2.4}/deepsights/contentstore/contentstore.py +0 -0
  27. {deepsights_api-1.2.3 → deepsights_api-1.2.4}/deepsights/contentstore/resources/__init__.py +0 -0
  28. {deepsights_api-1.2.3 → deepsights_api-1.2.4}/deepsights/contentstore/resources/_download.py +0 -0
  29. {deepsights_api-1.2.3 → deepsights_api-1.2.4}/deepsights/contentstore/resources/_model.py +0 -0
  30. {deepsights_api-1.2.3 → deepsights_api-1.2.4}/deepsights/deepsights/__init__.py +0 -0
  31. {deepsights_api-1.2.3 → deepsights_api-1.2.4}/deepsights/deepsights/_mip_identity.py +0 -0
  32. {deepsights_api-1.2.3 → deepsights_api-1.2.4}/deepsights/deepsights/deepsights.py +0 -0
  33. {deepsights_api-1.2.3 → deepsights_api-1.2.4}/deepsights/deepsights/resources/__init__.py +0 -0
  34. {deepsights_api-1.2.3 → deepsights_api-1.2.4}/deepsights/deepsights/resources/quota/__init__.py +0 -0
  35. {deepsights_api-1.2.3 → deepsights_api-1.2.4}/deepsights/deepsights/resources/quota/_model.py +0 -0
  36. {deepsights_api-1.2.3 → deepsights_api-1.2.4}/deepsights/deepsights/resources/quota/quota.py +0 -0
  37. {deepsights_api-1.2.3 → deepsights_api-1.2.4}/deepsights/documentstore/__init__.py +0 -0
  38. {deepsights_api-1.2.3 → deepsights_api-1.2.4}/deepsights/documentstore/documentstore.py +0 -0
  39. {deepsights_api-1.2.3 → deepsights_api-1.2.4}/deepsights/documentstore/resources/__init__.py +0 -0
  40. {deepsights_api-1.2.3 → deepsights_api-1.2.4}/deepsights/documentstore/resources/documents/__init__.py +0 -0
  41. {deepsights_api-1.2.3 → deepsights_api-1.2.4}/deepsights/documentstore/resources/documents/_cache.py +0 -0
  42. {deepsights_api-1.2.3 → deepsights_api-1.2.4}/deepsights/documentstore/resources/documents/_delete.py +0 -0
  43. {deepsights_api-1.2.3 → deepsights_api-1.2.4}/deepsights/documentstore/resources/documents/_download.py +0 -0
  44. {deepsights_api-1.2.3 → deepsights_api-1.2.4}/deepsights/documentstore/resources/documents/_list.py +0 -0
  45. {deepsights_api-1.2.3 → deepsights_api-1.2.4}/deepsights/documentstore/resources/documents/_load.py +0 -0
  46. {deepsights_api-1.2.3 → deepsights_api-1.2.4}/deepsights/documentstore/resources/documents/_model.py +0 -0
  47. {deepsights_api-1.2.3 → deepsights_api-1.2.4}/deepsights/documentstore/resources/documents/_search.py +0 -0
  48. {deepsights_api-1.2.3 → deepsights_api-1.2.4}/deepsights/documentstore/resources/documents/_segmenter.py +0 -0
  49. {deepsights_api-1.2.3 → deepsights_api-1.2.4}/deepsights/documentstore/resources/documents/_upload.py +0 -0
  50. {deepsights_api-1.2.3 → deepsights_api-1.2.4}/deepsights/documentstore/resources/documents/documents.py +0 -0
  51. {deepsights_api-1.2.3 → deepsights_api-1.2.4}/deepsights/userclient/__init__.py +0 -0
  52. {deepsights_api-1.2.3 → deepsights_api-1.2.4}/deepsights/userclient/resources/__init__.py +0 -0
  53. {deepsights_api-1.2.3 → deepsights_api-1.2.4}/deepsights/userclient/resources/_model.py +0 -0
  54. {deepsights_api-1.2.3 → deepsights_api-1.2.4}/deepsights/userclient/resources/answersV2/__init__.py +0 -0
  55. {deepsights_api-1.2.3 → deepsights_api-1.2.4}/deepsights/userclient/resources/answersV2/_model.py +0 -0
  56. {deepsights_api-1.2.3 → deepsights_api-1.2.4}/deepsights/userclient/resources/answersV2/answerV2.py +0 -0
  57. {deepsights_api-1.2.3 → deepsights_api-1.2.4}/deepsights/userclient/resources/reports/__init__.py +0 -0
  58. {deepsights_api-1.2.3 → deepsights_api-1.2.4}/deepsights/userclient/resources/reports/_model.py +0 -0
  59. {deepsights_api-1.2.3 → deepsights_api-1.2.4}/deepsights/userclient/resources/reports/report.py +0 -0
  60. {deepsights_api-1.2.3 → deepsights_api-1.2.4}/deepsights/userclient/userclient.py +0 -0
  61. {deepsights_api-1.2.3 → deepsights_api-1.2.4}/deepsights/utils/__init__.py +0 -0
  62. {deepsights_api-1.2.3 → deepsights_api-1.2.4}/deepsights/utils/_cache.py +0 -0
  63. {deepsights_api-1.2.3 → deepsights_api-1.2.4}/deepsights/utils/_ranking.py +0 -0
  64. {deepsights_api-1.2.3 → deepsights_api-1.2.4}/deepsights/utils/_utils.py +0 -0
  65. {deepsights_api-1.2.3 → deepsights_api-1.2.4}/deepsights/utils/model.py +0 -0
  66. {deepsights_api-1.2.3 → deepsights_api-1.2.4}/docs/.gitkeep +0 -0
  67. {deepsights_api-1.2.3 → deepsights_api-1.2.4}/main.py +0 -0
  68. {deepsights_api-1.2.3 → deepsights_api-1.2.4}/requirements.txt +0 -0
  69. {deepsights_api-1.2.3 → deepsights_api-1.2.4}/setup.py +0 -0
  70. {deepsights_api-1.2.3 → deepsights_api-1.2.4}/tests/data/test_presentation.pdf +0 -0
  71. {deepsights_api-1.2.3 → deepsights_api-1.2.4}/tests/data/test_text.txt +0 -0
  72. {deepsights_api-1.2.3 → deepsights_api-1.2.4}/tests/deepsights/identity/test_mip_identity.py +0 -0
  73. {deepsights_api-1.2.3 → deepsights_api-1.2.4}/tests/deepsights/quota/test_quota.py +0 -0
  74. {deepsights_api-1.2.3 → deepsights_api-1.2.4}/tests/deepsights/userclient/test_userclient.py +0 -0
  75. {deepsights_api-1.2.3 → deepsights_api-1.2.4}/tests/documentstore/test_download.py +0 -0
  76. {deepsights_api-1.2.3 → deepsights_api-1.2.4}/tests/documentstore/test_lifecycle.py +0 -0
  77. {deepsights_api-1.2.3 → deepsights_api-1.2.4}/tests/documentstore/test_list.py +0 -0
  78. {deepsights_api-1.2.3 → deepsights_api-1.2.4}/tests/documentstore/test_load.py +0 -0
  79. {deepsights_api-1.2.3 → deepsights_api-1.2.4}/tests/documentstore/test_search.py +0 -0
  80. {deepsights_api-1.2.3 → deepsights_api-1.2.4}/tests/userclient/answersV2/test_answersV2.py +0 -0
  81. {deepsights_api-1.2.3 → deepsights_api-1.2.4}/tests/userclient/reports/test_reports.py +0 -0
@@ -2,10 +2,13 @@
2
2
 
3
3
  <!--next-version-placeholder-->
4
4
 
5
- ## v1.2.3 (25-Jan-2025)
5
+ ## v1.2.4 (16-Arp-2025)
6
+
7
+ - Sort order in SCS text search
6
8
 
7
- - Support item text download from content store
9
+ ## v1.2.3 (25-Jan-2025)
8
10
 
11
+ - Support item text download from cont
9
12
 
10
13
  ## v1.2.2 (12-Jan-2025)
11
14
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: deepsights-api
3
- Version: 1.2.3
3
+ Version: 1.2.4
4
4
  Summary: Python library for the DeepSights APIs
5
5
  Project-URL: Documentation, https://marketlogicsoftware.github.io/deepsights-api/
6
6
  Project-URL: Repository, https://github.com/marketlogicsoftware/deepsights-api
@@ -16,9 +16,11 @@
16
16
  This module contains the base functions to search the ContentStore.
17
17
  """
18
18
 
19
- from typing import List
20
19
  from datetime import datetime
20
+ from typing import List
21
+
21
22
  from pydantic import BaseModel
23
+
22
24
  from deepsights.api import API
23
25
  from deepsights.utils import (
24
26
  promote_exact_matches,
@@ -96,9 +98,9 @@ def contentstore_hybrid_search(
96
98
  assert 0 <= vector_fraction <= 1, "Vector fraction must be between 0 and 1"
97
99
  assert 0 <= vector_weight <= 1, "Vector weught must be between 0 and 1"
98
100
  assert 0 < max_results <= 250, "Maximum results must be between 1 and 250."
99
- assert (
100
- recency_weight is None or 0 <= recency_weight <= 1
101
- ), "Recency weight must be between 0 and 1."
101
+ assert recency_weight is None or 0 <= recency_weight <= 1, (
102
+ "Recency weight must be between 0 and 1."
103
+ )
102
104
 
103
105
  body = {
104
106
  "query": query,
@@ -171,9 +173,9 @@ def contentstore_vector_search(
171
173
  assert len(query_embedding) == 1536, "The 'query_embedding' must be of length 1536."
172
174
  assert 0 <= min_score <= 1, "Minimum score must be between 0 and 1."
173
175
  assert 0 < max_results <= 100, "Maximum results must be between 1 and 100."
174
- assert (
175
- recency_weight is None or 0 <= recency_weight <= 1
176
- ), "Recency weight must be between 0 and 1."
176
+ assert recency_weight is None or 0 <= recency_weight <= 1, (
177
+ "Recency weight must be between 0 and 1."
178
+ )
177
179
 
178
180
  body = {
179
181
  "vector": query_embedding,
@@ -206,7 +208,7 @@ def contentstore_text_search(
206
208
  max_results: int = 50,
207
209
  offset: int = 0,
208
210
  languages: List[str] = None,
209
- recency_weight: float = None,
211
+ sort_descending: bool = True,
210
212
  search_from_timestamp: datetime = None,
211
213
  search_to_timestamp: datetime = None,
212
214
  search_only_ai_allowed_content: bool = True,
@@ -223,7 +225,7 @@ def contentstore_text_search(
223
225
  max_results (int, optional): The maximum number of results to return. Defaults to 50.
224
226
  offset (int, optional): The offset to start the search from. Defaults to 0.
225
227
  languages (List[str], optional): The languages to search for. Defaults to None.
226
- recency_weight (float, optional): The weight assigned to recency in result ranking. Defaults to None.
228
+ most_recent_first (bool, optional): Whether to sort results by most recent first. Defaults to True.
227
229
  search_from_timestamp (datetime, optional): The start timestamp for the search. Defaults to None.
228
230
  search_to_timestamp (datetime, optional): The end timestamp for the search. Defaults to None.
229
231
  search_only_ai_allowed_content (bool, optional): Whether to search only AI-allowed content. Defaults to True.
@@ -233,21 +235,24 @@ def contentstore_text_search(
233
235
  List[BaseModel]: The re-ranked search results.
234
236
  """
235
237
  assert 0 < max_results <= 100, "Maximum results must be between 1 and 100."
236
- assert (
237
- recency_weight is None or 0 <= recency_weight <= 1
238
- ), "Recency weight must be between 0 and 1."
239
238
 
240
239
  # force proper empty search
241
240
  if query is not None and len(query.strip()) == 0:
242
241
  query = None
243
242
 
243
+ # determine sort order
244
+ if query is not None:
245
+ sort_order = "RELEVANCY_DESC" if sort_descending else "RELEVANCY_ASC"
246
+ else:
247
+ sort_order = "PUBLISHED_AT_DESC" if sort_descending else "PUBLISHED_AT_ASC"
248
+
244
249
  body = {
245
250
  "query": query,
246
251
  "source_items_type": item_type,
247
252
  "content_restrictions": "NONE",
248
253
  "limit": max_results,
249
254
  "offset": offset,
250
- "sort": "RELEVANCY_DESC" if query is not None else "PUBLISHED_AT_DESC",
255
+ "sort": sort_order,
251
256
  "languages": languages,
252
257
  "published_at": _get_time_filter(search_from_timestamp, search_to_timestamp),
253
258
  "content_restrictions": (
@@ -259,5 +264,8 @@ def contentstore_text_search(
259
264
  # parse
260
265
  results = [search_result(i) for i in response["items"]]
261
266
 
262
- # re-rank
263
- return rerank_by_recency(results, recency_weight=recency_weight)
267
+ # record rank
268
+ for rank, result in enumerate(results):
269
+ result.rank = rank + 1
270
+
271
+ return results
@@ -99,7 +99,7 @@ class NewsResource(APIResource):
99
99
  max_results: int = 30,
100
100
  offset: int = 0,
101
101
  languages: List[str] = None,
102
- recency_weight: float = None,
102
+ sort_descending: bool = True,
103
103
  search_from_timestamp: datetime = None,
104
104
  search_to_timestamp: datetime = None,
105
105
  ):
@@ -112,7 +112,7 @@ class NewsResource(APIResource):
112
112
  max_results (int, optional): The maximum number of search results to return. Defaults to 30.
113
113
  offset (int, optional): The offset to start the search from. Defaults to 0.
114
114
  languages (List[str], optional): The list of languages to search for. Defaults to None.
115
- recency_weight (float, optional): The weight to assign to recency in the search ranking. Defaults to None.
115
+ sort_descending (bool, optional): Whether to sort the results in descending order. Defaults to True.
116
116
  search_from_timestamp (datetime, optional): The start timestamp for the search. Defaults to None.
117
117
  search_to_timestamp (datetime, optional): The end timestamp for the search. Defaults to None.
118
118
 
@@ -128,7 +128,7 @@ class NewsResource(APIResource):
128
128
  ),
129
129
  query=query,
130
130
  max_results=max_results,
131
- recency_weight=recency_weight,
131
+ sort_descending=sort_descending,
132
132
  languages=languages,
133
133
  offset=offset,
134
134
  search_from_timestamp=search_from_timestamp,
@@ -99,7 +99,7 @@ class SecondaryResource(APIResource):
99
99
  max_results: int = 50,
100
100
  offset: int = 0,
101
101
  languages: List[str] = None,
102
- recency_weight: float = None,
102
+ sort_descending: bool = True,
103
103
  search_from_timestamp: datetime = None,
104
104
  search_to_timestamp: datetime = None,
105
105
  ):
@@ -112,7 +112,7 @@ class SecondaryResource(APIResource):
112
112
  max_results (int, optional): The maximum number of search results to return. Defaults to 50.
113
113
  offset (int, optional): The offset to start the search from. Defaults to 0.
114
114
  languages (List[str], optional): The languages to search for. Defaults to None.
115
- recency_weight (float, optional): The weight to assign to recency in the search ranking. Defaults to None.
115
+ sort_descending (bool, optional): Whether to sort the results in descending order. Defaults to True.
116
116
  search_from_timestamp (datetime, optional): The start timestamp for the search. Defaults to None.
117
117
  search_to_timestamp (datetime, optional): The end timestamp for the search. Defaults to None.
118
118
 
@@ -130,7 +130,7 @@ class SecondaryResource(APIResource):
130
130
  max_results=max_results,
131
131
  offset=offset,
132
132
  languages=languages,
133
- recency_weight=recency_weight,
133
+ sort_descending=sort_descending,
134
134
  search_from_timestamp=search_from_timestamp,
135
135
  search_to_timestamp=search_to_timestamp,
136
136
  )
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "deepsights-api"
3
- version = "1.2.3"
3
+ version = "1.2.4"
4
4
  description = "Python library for the DeepSights APIs"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.10"
@@ -163,51 +163,43 @@ def test_news_text_search_with_date():
163
163
  assert result.publication_date <= end and result.publication_date >= start
164
164
 
165
165
 
166
- def test_news_text_search_with_recency_low():
166
+ def test_news_text_search_descending():
167
167
  """
168
- Test the news text search function with a low recency weight.
169
-
170
- This test verifies that the news text search function returns results
171
- when the recency weight is set to a low value. It checks that the
172
- returned results have valid IDs, ranks, score ranks, and age ranks,
173
- and that the final rank is identical to the score rank.
174
-
175
- Note: This test assumes the existence of a `test_query` variable.
168
+ Test news text search with descending publication date sort order.
169
+ Verifies results have valid IDs, sequential ranks, and descending dates.
176
170
  """
177
-
178
171
  results = ds.contentstore.news.text_search(
179
- query=test_query,
172
+ query=None,
180
173
  max_results=10,
181
- recency_weight=0.00001,
174
+ sort_descending=True,
182
175
  )
183
176
 
184
177
  assert len(results) > 0
185
178
  for ix, result in enumerate(results):
186
179
  assert result.id is not None
187
180
  assert result.rank == ix + 1
181
+ if ix < len(results) - 1:
182
+ assert result.publication_date >= results[ix + 1].publication_date
188
183
 
189
184
 
190
- def test_news_text_search_with_recency_high():
185
+ def test_news_text_search_ascending():
191
186
  """
192
- Test the news text search function with a high recency weight.
193
-
194
- This test verifies that the news text search function returns results
195
- when the recency weight is set to a high value. It checks that the
196
- returned results have valid IDs, ranks, score ranks, and age ranks,
197
- and that the final rank is identical to the age rank.
198
-
199
- Note: This test assumes the existence of a `test_query` variable.
187
+ Test news text search with ascending publication date sort order.
188
+ Verifies results have valid IDs, sequential ranks, and ascending dates.
200
189
  """
190
+
201
191
  results = ds.contentstore.news.text_search(
202
- query=test_query,
192
+ query=None,
203
193
  max_results=10,
204
- recency_weight=0.99999,
194
+ sort_descending=False,
205
195
  )
206
196
 
207
197
  assert len(results) > 0
208
198
  for ix, result in enumerate(results):
209
199
  assert result.id is not None
210
200
  assert result.rank == ix + 1
201
+ if ix < len(results) - 1:
202
+ assert result.publication_date <= results[ix + 1].publication_date
211
203
 
212
204
 
213
205
  def test_news_vector_search():
@@ -360,9 +352,7 @@ def test_news_hybrid_search_only_text():
360
352
  )
361
353
 
362
354
  text_results = ds.contentstore.news.text_search(
363
- query=test_query,
364
- max_results=results,
365
- recency_weight=0.0,
355
+ query=test_query, max_results=results
366
356
  )
367
357
 
368
358
  assert len(hybrid_results) == results
@@ -450,19 +440,19 @@ def test_news_hybrid_search_with_vector_high():
450
440
  """
451
441
  hybrid_results = ds.contentstore.news.search(
452
442
  query=test_query,
453
- max_results=10,
454
- vector_weight=0.99999,
443
+ max_results=5,
444
+ vector_weight=0.9999999999,
455
445
  vector_fraction=1.0,
456
446
  recency_weight=0.0,
457
447
  )
458
448
 
459
449
  vector_results = ds.contentstore.news.vector_search(
460
450
  query_embedding=test_embedding,
461
- max_results=10,
451
+ max_results=5,
462
452
  recency_weight=0.0,
463
453
  )
464
454
 
465
- assert len(hybrid_results) == 10
455
+ assert len(hybrid_results) == 5
466
456
  for ix, result in enumerate(hybrid_results):
467
457
  assert equal_results(result, vector_results[ix])
468
458
 
@@ -487,7 +477,6 @@ def test_news_hybrid_search_with_vector_low():
487
477
  text_results = ds.contentstore.news.text_search(
488
478
  query=test_query,
489
479
  max_results=results,
490
- recency_weight=0.0,
491
480
  )
492
481
 
493
482
  assert len(hybrid_results) == results
@@ -164,51 +164,43 @@ def test_secondary_text_search_with_date():
164
164
  assert result.publication_date <= end and result.publication_date >= start
165
165
 
166
166
 
167
- def test_secondary_text_search_with_recency_low():
167
+ def test_secondary_text_search_descending():
168
168
  """
169
- Test the secondary text search function with a low recency weight.
170
-
171
- This test verifies that the secondary text search function returns results
172
- when the recency weight is set to a low value. It checks that the
173
- returned results have valid IDs, ranks, score ranks, and age ranks,
174
- and that the final rank is identical to the score rank.
175
-
176
- Note: This test assumes the existence of a `test_query` variable.
169
+ Test secondary text search with descending publication date sort order.
170
+ Verifies results have valid IDs, sequential ranks, and descending dates.
177
171
  """
178
-
179
172
  results = ds.contentstore.secondary.text_search(
180
- query=test_query,
173
+ query=None,
181
174
  max_results=10,
182
- recency_weight=0.00001,
175
+ sort_descending=True,
183
176
  )
184
177
 
185
178
  assert len(results) > 0
186
179
  for ix, result in enumerate(results):
187
180
  assert result.id is not None
188
181
  assert result.rank == ix + 1
182
+ if ix < len(results) - 1:
183
+ assert result.publication_date >= results[ix + 1].publication_date
189
184
 
190
185
 
191
- def test_secondary_text_search_with_recency_high():
186
+ def test_secondary_text_search_ascending():
192
187
  """
193
- Test the secondary text search function with a high recency weight.
194
-
195
- This test verifies that the secondary text search function returns results
196
- when the recency weight is set to a high value. It checks that the
197
- returned results have valid IDs, ranks, score ranks, and age ranks,
198
- and that the final rank is identical to the age rank.
199
-
200
- Note: This test assumes the existence of a `test_query` variable.
188
+ Test secondary text search with ascending publication date sort order.
189
+ Verifies results have valid IDs, sequential ranks, and ascending dates.
201
190
  """
191
+
202
192
  results = ds.contentstore.secondary.text_search(
203
- query=test_query,
193
+ query=None,
204
194
  max_results=10,
205
- recency_weight=0.99999,
195
+ sort_descending=False,
206
196
  )
207
197
 
208
198
  assert len(results) > 0
209
199
  for ix, result in enumerate(results):
210
200
  assert result.id is not None
211
201
  assert result.rank == ix + 1
202
+ if ix < len(results) - 1:
203
+ assert result.publication_date <= results[ix + 1].publication_date
212
204
 
213
205
 
214
206
  def test_secondary_vector_search():
@@ -359,7 +351,6 @@ def test_secondary_hybrid_search_only_text():
359
351
  text_results = ds.contentstore.secondary.text_search(
360
352
  query=test_query,
361
353
  max_results=5,
362
- recency_weight=0.0,
363
354
  )
364
355
 
365
356
  assert len(hybrid_results) == 5
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "comment": "text-ada-002 embedding for 'What are emerging food moments with Gen Z consumers?'",
3
3
  "question": "What are emerging food moments with Gen Z consumers?",
4
- "document_id": "900aa7c7-60f4-4b2e-bc33-9dba20f4508f",
5
- "document_page_id": "3d861e4e-37cd-4a7b-b4cf-6986556f9544",
6
- "report_id": "7e9943f3-d9b8-4b36-86b0-c5ef939fcc71",
4
+ "document_id": "b3d728a6-6ef8-4c31-9949-dcc49439f4f1",
5
+ "document_page_id": "319eb5ab-e701-402e-881f-be3ccede65b3",
6
+ "report_id": "44126fc2-2aff-47c0-ac3f-d86bd6afcca2",
7
7
  "answerV2_id": "7511f5dd-bb5d-4082-8799-0d1733d61afc",
8
8
  "embedding": [
9
9
  -0.0012380050029605627,