fix(wiki_tools): return list of result dicts for semantic_search return_json#126
Open
LukasGold wants to merge 2 commits into
Open
fix(wiki_tools): return list of result dicts for semantic_search return_json#126LukasGold wants to merge 2 commits into
LukasGold wants to merge 2 commits into
Conversation
…rn_json semantic_search with SearchParam.return_json=True previously fed the raw SMW ask result dicts into the flat-list comprehension, so iterating each dict yielded its keys and the call returned a useless list like ['query'] instead of the result data. Skip the flatten when return_json=True and return the list of raw result dicts (one per query, always a list even for a single query). The default return_json=False behavior (flat list of page-title fulltext strings) is unchanged. Add unit tests covering return_json=True for a single query and a list of queries, plus return_json=False still returning a flat list of titles.
Coverage Report for CI Build 28228157869Coverage increased (+0.4%) to 50.975%Details
Uncovered Changes
Coverage Regressions2 previously-covered lines in 1 file lost coverage.
Coverage Stats
💛 - Coveralls |
…rn_json prefix_search with SearchParam.return_json=True returned result['query']['prefixsearch'] (the page-entry list) and still ran it through the flat-list comprehension, merging entries across queries into a single flat list and contradicting the docstring's promise of the full API response per query. Mirror the semantic_search behavior: the inner helper now returns the full raw prefixsearch API response, and the outer function skips the flatten when return_json=True, returning a list of response dicts (one per query, always a list even for a single query). The default return_json=False behavior (flat list of page titles) is unchanged. Add unit tests covering return_json=True for a single query and a list of queries, plus return_json=False still returning a flat list of titles.
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.
No description provided.