mirror of
https://github.com/searxng/searxng.git
synced 2026-10-25 05:44:14 +00:00
Wikidata kept showing up in `unresponsive_engines` as "unexpected crash", but only for some queries (`!wikidata loi anti gaspillage` for instance). In `get_results`, `itemDescription` defaults to `[]`. When an entity has no description and `display_type` contains `"list"`, that empty list goes out as the `content` of a list result, and `ResultContainer.extend` fails with `TypeError: expected string or bytes-like object, got 'list'`. Every wikidata result of the query is dropped with it. The default is now an empty string. `len(infobox_content) == 0` still works, and the infobox branch already expected a string. `tests/unit/test_engine_wikidata.py` covers an entity with no description, once with `display_type` `["list"]` and once with `["infobox"]`. Without the fix both tests fail (`'content': []` instead of `''`), with it both pass. itemDescription defaulted to [] in get_results. With "list" in display_type, that empty list was sent as the content of a list result and ResultContainer.extend raised a TypeError, so the whole wikidata answer of the query was lost. Default to an empty string instead. Signed-off-by: Guillaume PUTIER <putier.guillaume@gmail.com> Co-authored-by: Guillaume PUTIER <putier.guillaume@gmail.com>