/search - updated search end point
Why?
This is an explanation of the new search endpoint with some test runs and example use-cases.
Details
Date Run: 2025-04-20 14:55:11
Target Endpoint: https://wissen-ai.onrender.com/new_search
Understanding the /new_search Endpoint Logic
The /new_search endpoint performs multimodal semantic search across financial documents using text queries and optional metadata filters. It operates in two primary modes:
-
Metadata Mode:
- Activation: Provide an
equity_tickerin the request body. Do not providecontent_uids. - Behavior: Searches across all documents matching the
equity_tickerand any additional optional filters (fiscal_years,fiscal_quarters,content_types,event_types). - Filtering: Combines all provided filters using AND logic.
- Result Generation: Runs searches for each unique combination of filters (e.g., Ticker+Year1+TypeA, Ticker+Year2+TypeA, Ticker+Year1+TypeB).
top_kresults are fetched for each combination. - Aggregation: Results from all combinations are combined, duplicates (based on
page_uid) are removed, and the final list is sorted by relevance distance (_distance). The total number of results might differ fromtop_kdue to this aggregation and deduplication.
- Activation: Provide an
-
Content UID Mode:
- Activation: Provide a list of
content_uidsin the request body. - Behavior: Restricts the search only to the specified documents. All other metadata filters (
equity_ticker,fiscal_years, etc.) are ignored. - Result Generation:
top_kresults are returned for each specifiedcontent_uidindependently. - Aggregation: Results from all specified UIDs are combined, duplicates are removed, and the list is sorted by relevance.
- Activation: Provide a list of
Key Parameter: The query (string) is always required.
Test Case Results
Test 1: Metadata Search - Ticker Only (KO)
Rationale: Tests the most basic metadata search, filtering only by ticker. Useful for broad queries about a company when specific timeframes or document types are unknown or irrelevant.
Request Payload:
{
"query": "What were the main financial results last quarter?",
"equity_ticker": "KO",
"top_k": 3
}
Status Code: 200
Duration: 1.16s
Response Summary:
{
"status_code": 200,
"duration_seconds": 1.160382,
"response_page_count": 3,
"response_search_mode": "metadata",
"response_error_count": 0,
"response_result_count": 3,
"response_first_result_distance": 1.3252438306808472
}
Full Results: (Text content truncated to 100 chars)
| page_uid | content_uid | ticker | FY | FQ | content_type | event_type | page_no | distance | Text (Truncated) |
|---|---|---|---|---|---|---|---|---|---|
| abd97e69-38a7-4471-a566-40cc2d6822c0 | 8dc941b5-e6e6-4d5a-b0e9-59bbe260cefd | KO | 2023 | 1 | earnings_transcript | periodic | 8 | 1.3252 | James Quincey: We're executing more efficiently and effectively on a local level, maintaining flexib... |
| af4d1b39-aafa-4623-b0e4-e731ab7143c1 | 962fd160-06f2-4366-b3f3-fa20217c60c6 | KO | 2023 | 2 | earnings_transcript | periodic | 28 | 1.3343 | James Quincey: Yes. Thank you, operator. So just to quickly summarize. Second quarter results, I thi... |
| 0cae4847-9ad8-45c9-9a75-48046bc5cb13 | 8dc941b5-e6e6-4d5a-b0e9-59bbe260cefd | KO | 2023 | 1 | earnings_transcript | periodic | 3 | 1.3531 | value by meeting the needs of our customers and consumers. James Quincey: We delivered 12% orga... |
Test 2: Metadata Search - Ticker + Year + Content Type (KO)
Rationale: Tests filtering by ticker, a specific year, and a specific document type. Useful for targeted queries within a known document and timeframe (e.g., specific data in an annual report).
Request Payload:
{
"query": "Discuss beverage volume growth in 2023 annual report.",
"equity_ticker": "KO",
"fiscal_years": [
2023
],
"content_types": [
"annual_report"
],
"top_k": 5
}
Status Code: 200
Duration: 1.00s
Response Summary:
{
"status_code": 200,
"duration_seconds": 1.004536,
"response_page_count": 5,
"response_search_mode": "metadata",
"response_error_count": 0,
"response_result_count": 5,
"response_first_result_distance": 1.139526128768921
}
Full Results: (Text content truncated to 100 chars)
| page_uid | content_uid | ticker | FY | FQ | content_type | event_type | page_no | distance | Text (Truncated) |
|---|---|---|---|---|---|---|---|---|---|
| 21919bfb-41f5-4b1f-85e0-f09df09fcc42 | e8b867e0-79c0-421a-9803-938fa60df8b6 | KO | 2023 | 4 | annual_report | periodic | 46 | 1.1395 | unit case volume of our consolidated bottling operations. Refer to Note 2 of Notes to Consolidated F... |
| 6dcc0a8f-434c-472f-a6ee-49ba35a79736 | e8b867e0-79c0-421a-9803-938fa60df8b6 | KO | 2023 | 4 | annual_report | periodic | 47 | 1.1676 | Information about our volume growth worldwide and by operating segment is as follows: ... |
| 9cc25cc0-9576-4355-a78f-d5d988a53ff6 | e8b867e0-79c0-421a-9803-938fa60df8b6 | KO | 2023 | 4 | annual_report | periodic | 15 | 1.1808 | Throughout 2023, the Company faced disruptions to our operations due to international conflicts, inc... |
| cfa78dd2-22d5-45ef-aebc-0eadf8191021 | e8b867e0-79c0-421a-9803-938fa60df8b6 | KO | 2023 | 4 | annual_report | periodic | 4 | 1.2127 | FORWARD-LOOKING STATEMENTS This report contains information that may constitute "forward-looking sta... |
| 0c278c3b-72bd-4490-8a0f-97b701714d93 | e8b867e0-79c0-421a-9803-938fa60df8b6 | KO | 2023 | 4 | annual_report | periodic | 39 | 1.2314 | The following table sets forth the percentage of total net operating revenues attributable to concen... |
Test 3: Metadata Search - Ticker + Event Type (KO)
Rationale: Tests filtering by ticker and event type. Useful for finding information related to specific kinds of company events (e.g., conferences) across different document types and timeframes.
Request Payload:
{
"query": "What was mentioned about marketing at company conferences?",
"equity_ticker": "KO",
"event_types": [
"company_conference"
],
"top_k": 4
}
Status Code: 200
Duration: 1.06s
Response Summary:
{
"status_code": 200,
"duration_seconds": 1.064624,
"response_page_count": 4,
"response_search_mode": "metadata",
"response_error_count": 0,
"response_result_count": 4,
"response_first_result_distance": 1.1884548664093018
}
Full Results: (Text content truncated to 100 chars)
| page_uid | content_uid | ticker | FY | FQ | content_type | event_type | page_no | distance | Text (Truncated) |
|---|---|---|---|---|---|---|---|---|---|
| f714fce1-e0b9-44c6-ac8a-24b69c9e0fc9 | a4b3deba-ee39-49c9-a09a-f2a71f93bd26 | KO | None | None | company_conference_transcript | company_conference | 16 | 1.1885 | marketing, for example, allows us to have The data sets the tools in place in order to actually leve... |
| aa05e1de-652d-4fac-bdb3-0f53f5c305ac | ee674774-4e3e-434c-a922-0418c46aeff8 | KO | None | None | company_conference_transcript | company_conference | 25 | 1.2127 | this, because we were brought in the early days, was we actually revamped our marketing responsibili... |
| 85c49e62-88a7-489e-b06c-cb6ca3d6e8b1 | a4b3deba-ee39-49c9-a09a-f2a71f93bd26 | KO | None | None | company_conference_transcript | company_conference | 14 | 1.2229 | pleased with some of the progress we're making there and the tremendous partnerships we have. There'... |
| 99cc9b27-4ea0-4ea2-b20c-43f95a593df6 | ee674774-4e3e-434c-a922-0418c46aeff8 | KO | None | None | company_conference_transcript | company_conference | 22 | 1.2605 | my side, and then I'm going to sort of start taking some of these audience questions. The segue is f... |
Test 4: Metadata Search - Ticker + Content + Event (KO)
Rationale: Tests a combination of ticker, specific content type, and specific event type. Useful for highly specific queries (e.g., finding transcripts from periodic earnings calls).
Request Payload:
{
"query": "Key points from the periodic earnings transcript?",
"equity_ticker": "KO",
"content_types": [
"earnings_transcript"
],
"event_types": [
"periodic"
],
"top_k": 3
}
Status Code: 200
Duration: 0.90s
Response Summary:
{
"status_code": 200,
"duration_seconds": 0.901312,
"response_page_count": 3,
"response_search_mode": "metadata",
"response_error_count": 0,
"response_result_count": 3,
"response_first_result_distance": 1.2700271606445312
}
Full Results: (Text content truncated to 100 chars)
| page_uid | content_uid | ticker | FY | FQ | content_type | event_type | page_no | distance | Text (Truncated) |
|---|---|---|---|---|---|---|---|---|---|
| 5abc3ff7-4943-43d1-ada0-92a937c408b9 | 8dc941b5-e6e6-4d5a-b0e9-59bbe260cefd | KO | 2023 | 1 | earnings_transcript | periodic | 2 | 1.2700 | company's periodic SEC report. Following prepared remarks, we will turn the call over for questions.... |
| 958c63c1-4d4e-439b-92b3-b8b21346b095 | 8a258d7b-e02c-484b-92f4-54f984ea8115 | KO | 2023 | 3 | earnings_transcript | periodic | 27 | 1.3340 | question, operator. Okay. So to conclude, thanks very much, everyone. We've proven, I hope you can s... |
| 1787f880-86a1-48db-a46c-22fdf652a3a9 | f9d09c59-ba44-4e05-b038-02889ca2a1d3 | KO | 2020 | 2 | earnings_transcript | periodic | 26 | 1.3445 | of being able to adapt and react as markets demonstrate the trajectory that they're on. **John Murp... |
Test 6: Error Case - Invalid Event Type
Rationale: Tests the API's input validation by providing an event type string that is not in the allowed list. Expects a 422 error.
Request Payload:
{
"query": "Test invalid input",
"equity_ticker": "KO",
"event_types": [
"not_a_real_event_type"
]
}
Status Code: 422 (Expected: 422 ✅)
Duration: 0.64s
Response Summary:
{
"status_code": 422,
"duration_seconds": 0.643378,
"response_detail": "Invalid event_type value 'not_a_real_event_type'. Allowed values are: {'other', 'periodic', 'industry_conference', 'company_conference', 'sellside_conference'}"
}
Test 7: Error Case - Missing Ticker and UID
Rationale: Tests the API's input validation for search mode activation. Neither equity_ticker nor content_uids are provided, which should result in a 422 error.
Request Payload:
{
"query": "This should fail validation",
"top_k": 1
}
Status Code: 422 (Expected: 422 ✅)
Duration: 0.93s
Response Summary:
{
"status_code": 422,
"duration_seconds": 0.931779,
"response_detail": "Insufficient parameters for search. Provide either 'content_uids' or 'equity_ticker'."
}
Test 8: Error Case - Invalid Fiscal Quarter
Rationale: Tests the API's input validation for fiscal_quarters. Providing a value outside the allowed range (1-4) should result in a 422 error.
Request Payload:
{
"query": "Test invalid quarter",
"equity_ticker": "KO",
"fiscal_quarters": [
5
]
}
Status Code: 422 (Expected: 422 ✅)
Duration: 0.95s
Response Summary:
{
"status_code": 422,
"duration_seconds": 0.951759,
"response_detail": "Invalid fiscal_quarter value '5': Must be 1, 2, 3, or 4."
}