Skip to content

Commit 543e56d

Browse files
committed
Enhance DocumentClient and SearchRequest models with additional filtering options
## Summary This commit updates the `DocumentClient` and `SearchRequest` classes to include new optional parameters for enhanced search capabilities. ## Key Accomplishments - **New Parameters**: Added `element`, `fiscal_year`, `date_from`, and `date_to` parameters to the `DocumentClient` search method, allowing for more granular filtering of search results. - **Documentation Updates**: Improved docstrings for the `DocumentClient` and `SearchRequest` classes to reflect the new parameters and their usage. ## Changes Breakdown - Updated method signatures and docstrings in `document_client.py` to include new filtering options. - Removed the `semantic` parameter from `SearchRequest` as it is no longer utilized. ## Testing Notes - Verify that the new parameters function correctly in search queries and return expected results. - Ensure that existing functionality remains intact and that the removal of the `semantic` parameter does not affect current implementations. ## Infrastructure Considerations - No breaking changes introduced; existing functionality remains intact.
1 parent 8bf0343 commit 543e56d

2 files changed

Lines changed: 17 additions & 16 deletions

File tree

‎robosystems_client/extensions/document_client.py‎

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -162,19 +162,26 @@ def search(
162162
entity: Optional[str] = None,
163163
form_type: Optional[str] = None,
164164
section: Optional[str] = None,
165-
semantic: bool = False,
165+
element: Optional[str] = None,
166+
fiscal_year: Optional[int] = None,
167+
date_from: Optional[str] = None,
168+
date_to: Optional[str] = None,
166169
size: int = 10,
167170
) -> SearchResponse:
168-
"""Search documents with full-text or semantic search.
171+
"""Search documents with hybrid (BM25 + KNN) search.
169172
170173
Args:
171174
graph_id: Target graph ID.
172175
query: Search query string.
173-
source_type: Filter by source type (uploaded_doc, memory, etc.).
176+
source_type: Filter by source type (xbrl_textblock, narrative_section,
177+
ixbrl_disclosure, uploaded_doc, memory).
174178
entity: Filter by entity ticker/CIK/name.
175-
form_type: Filter by SEC form type.
176-
section: Filter by section ID.
177-
semantic: Enable semantic (vector) search.
179+
form_type: Filter by SEC form type (10-K, 10-Q).
180+
section: Filter by section ID (item_1, item_1a, item_7, etc.).
181+
element: Filter by XBRL element qname (e.g., us-gaap:Goodwill).
182+
fiscal_year: Filter by fiscal year.
183+
date_from: Filter filings on or after date (YYYY-MM-DD).
184+
date_to: Filter filings on or before date (YYYY-MM-DD).
178185
size: Max results to return.
179186
180187
Returns:
@@ -186,7 +193,10 @@ def search(
186193
entity=entity if entity is not None else UNSET,
187194
form_type=form_type if form_type is not None else UNSET,
188195
section=section if section is not None else UNSET,
189-
semantic=semantic,
196+
element=element if element is not None else UNSET,
197+
fiscal_year=fiscal_year if fiscal_year is not None else UNSET,
198+
date_from=date_from if date_from is not None else UNSET,
199+
date_to=date_to if date_to is not None else UNSET,
190200
size=size,
191201
)
192202

‎robosystems_client/models/search_request.py‎

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ class SearchRequest:
2626
fiscal_year (int | None | Unset): Filter by fiscal year
2727
date_from (None | str | Unset): Filter filings on or after date (YYYY-MM-DD)
2828
date_to (None | str | Unset): Filter filings on or before date (YYYY-MM-DD)
29-
semantic (bool | Unset): Enable semantic (vector) search if available Default: False.
3029
size (int | Unset): Max results to return Default: 10.
3130
offset (int | Unset): Pagination offset Default: 0.
3231
"""
@@ -40,7 +39,6 @@ class SearchRequest:
4039
fiscal_year: int | None | Unset = UNSET
4140
date_from: None | str | Unset = UNSET
4241
date_to: None | str | Unset = UNSET
43-
semantic: bool | Unset = False
4442
size: int | Unset = 10
4543
offset: int | Unset = 0
4644
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
@@ -96,8 +94,6 @@ def to_dict(self) -> dict[str, Any]:
9694
else:
9795
date_to = self.date_to
9896

99-
semantic = self.semantic
100-
10197
size = self.size
10298

10399
offset = self.offset
@@ -125,8 +121,6 @@ def to_dict(self) -> dict[str, Any]:
125121
field_dict["date_from"] = date_from
126122
if date_to is not UNSET:
127123
field_dict["date_to"] = date_to
128-
if semantic is not UNSET:
129-
field_dict["semantic"] = semantic
130124
if size is not UNSET:
131125
field_dict["size"] = size
132126
if offset is not UNSET:
@@ -211,8 +205,6 @@ def _parse_date_to(data: object) -> None | str | Unset:
211205

212206
date_to = _parse_date_to(d.pop("date_to", UNSET))
213207

214-
semantic = d.pop("semantic", UNSET)
215-
216208
size = d.pop("size", UNSET)
217209

218210
offset = d.pop("offset", UNSET)
@@ -227,7 +219,6 @@ def _parse_date_to(data: object) -> None | str | Unset:
227219
fiscal_year=fiscal_year,
228220
date_from=date_from,
229221
date_to=date_to,
230-
semantic=semantic,
231222
size=size,
232223
offset=offset,
233224
)

0 commit comments

Comments
 (0)