# SPDX-License-Identifier: AGPL-3.0-or-later # pyright: basic # lint: pylint """Type definitions of the result items from engines.""" from datetime import datetime from urllib.parse import ParseResult from typing import List, Dict, Set from typing_extensions import TypedDict, NotRequired, Required __all__ = [ 'Result', 'UrlResult', 'Answer', 'Correction', 'Suggestion', 'Infobox', 'InfoboxUrl', 'InfoboxImage', 'InfoboxAttribute', 'InfoboxRelatedTopic', 'Map', 'Paper', 'Video', 'Product', ] class Result(TypedDict): """A result from any type""" engine: str """Internal field. DO NOT USE""" weight: float """Internal field. DO NOT USE""" engines: Set[str] """Internal field. DO NOT USE""" category: str """Internal field. DO NOT USE""" positions: List[int] """Internal field. DO NOT USE""" score: float """Internal field. DO NOT USE""" class MainResult(Result): """Result that is going to be displayed as a "main" result""" template: NotRequired[str] """Template to display the result. The default value is "default.html". see searx/templates/simple/result_templates""" class UrlResult(MainResult): """Typical main result: an url, a title and a short description""" title: str """Title of the result""" url: str """URL of the result""" parsed_url: ParseResult """Engines don't have to set this value: it is automatically initialized from the url field. However, plugins have to manually update this field when they change the url field""" content: NotRequired[str] """Content of the result""" class Default(UrlResult): """Default result""" iframe_src: NotRequired[str] """URL of an iframe to add to the result.""" audio_src: NotRequired[str] """URL of