Files
searxng/tests
Guillaume P.andGuillaume PUTIER 6671d89bed [fix] engines: wikidata, no list as content when an entity has no description (#6824)
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>
2026-10-07 11:18:19 +02:00
..
2026-09-13 23:48:01 +02:00