{{ message }}
Repository navigation
Conversation
SearchApiWebSearch read organic_results only, so with search_params such as
{"engine": "perplexity"} the request succeeded but the component returned no
documents and no links. SearchApi's answer engines (google_ai_mode, perplexity,
chatgpt, gemini, bing_copilot) share one response shape: the answer as markdown
plus typed text_blocks, the cited sources as reference_links, and for Google AI
Mode the web_results it drew from.
When a response carries that shape, the component now returns the synthesized
answer as the first Document (content from the markdown field, rendered from
text_blocks when the API omits it), one Document per reference link, then the
web results. links holds the reference links followed by the web result links.
Classic engines are unchanged.
Tests cover the parser with and without markdown, with web results, with an
empty answer, and one run through the component with a mocked httpx.get.
Contributor
Contributor
|
Hi @hpdkhoa, thanks a lot for your contribution! 🙏 We noticed that the Contributor License Agreement (CLA) check ( To get your PR reviewed, please sign the CLA via the link in the |
HaystackBot
marked this pull request as draft
October 1, 2026 16:31
hpdkhoa
marked this pull request as ready for review
October 2, 2026 14:20
Contributor
Coverage report (searchapi)Click to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||
Contributor
|
Thanks for signing the CLA, @hpdkhoa! 🎉 This PR is now ready for review again and the reviewer has been re-assigned. |
Author
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

SearchApiWebSearch read organic_results only, so with search_params such as {"engine": "perplexity"} the request succeeded but the component returned no documents and no links. SearchApi's answer engines (google_ai_mode, perplexity, chatgpt, gemini, bing_copilot) share one response shape: the answer as markdown plus typed text_blocks, the cited sources as reference_links, and for Google AI Mode the web_results it drew from.
When a response carries that shape, the component now returns the synthesized answer as the first Document (content from the markdown field, rendered from text_blocks when the API omits it), one Document per reference link, then the web results. links holds the reference links followed by the web result links. Classic engines are unchanged.
Tests cover the parser with and without markdown, with web results, with an empty answer, and one run through the component with a mocked httpx.get.
Related Issues
None open.
SearchApiWebSearchreadsorganic_resultsonly, so withsearch_params={"engine": "perplexity"}(orgoogle_ai_mode,chatgpt,gemini,bing_copilot) it returns no documents and no links although the request succeeds.Proposed Changes
When a response carries the shared AI answer shape (
text_blocks,markdown,reference_links), the component now returns the synthesized answer as the firstDocument(content is themarkdownfield, rendered fromtext_blockswhen the API omits it), oneDocumentper cited reference link, and for Google AI Mode theweb_resultsit drew from.linksholds the reference links, then the web result links. Documents for the classic engines are unchanged. The class docstring documents the behaviour.How did you test it?
Unit tests for the parser (markdown present, markdown absent, web results, empty answer) and one run through
runwith a mockedhttpx.get.hatch run fmt-check,hatch run test:unitandhatch run test:typesequivalents pass locally (ruff, pytest with 21 unit tests, mypy). The integration test still requiresSEARCHAPI_API_KEY.Notes for the reviewer
_text_blocks_to_markdownand its two helpers are module-level functions rather than methods so the rendering stays easy to unit test and under the ruff complexity limits.Checklist
feat