diff options
author | Bnyro <bnyro@tutanota.com> | 2023-09-10 18:44:16 +0200 |
---|---|---|
committer | Markus Heiser <markus.heiser@darmarIT.de> | 2023-09-19 09:40:57 +0200 |
commit | dcee82334548ad8849391b5c29cdcd868b65daad (patch) | |
tree | 5313b41db400f0215c4b46a9af8bb51f1c11a8b2 /searx/search | |
parent | 71508abcbf77df7e996114e4f142a5f15eced6e4 (diff) | |
download | searxng-dcee82334548ad8849391b5c29cdcd868b65daad.tar.gz searxng-dcee82334548ad8849391b5c29cdcd868b65daad.zip |
[feat] implement feeling lucky feature
Diffstat (limited to 'searx/search')
-rw-r--r-- | searx/search/models.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/searx/search/models.py b/searx/search/models.py index 91e5d5982..ec1188fbb 100644 --- a/searx/search/models.py +++ b/searx/search/models.py @@ -37,6 +37,7 @@ class SearchQuery: 'timeout_limit', 'external_bang', 'engine_data', + 'redirect_to_first_result', ) def __init__( @@ -50,6 +51,7 @@ class SearchQuery: timeout_limit: typing.Optional[float] = None, external_bang: typing.Optional[str] = None, engine_data: typing.Optional[typing.Dict[str, str]] = None, + redirect_to_first_result: typing.Optional[bool] = None, ): self.query = query self.engineref_list = engineref_list @@ -60,6 +62,7 @@ class SearchQuery: self.timeout_limit = timeout_limit self.external_bang = external_bang self.engine_data = engine_data or {} + self.redirect_to_first_result = redirect_to_first_result self.locale = None if self.lang: @@ -73,7 +76,7 @@ class SearchQuery: return list(set(map(lambda engineref: engineref.category, self.engineref_list))) def __repr__(self): - return "SearchQuery({!r}, {!r}, {!r}, {!r}, {!r}, {!r}, {!r}, {!r})".format( + return "SearchQuery({!r}, {!r}, {!r}, {!r}, {!r}, {!r}, {!r}, {!r}, {!r})".format( self.query, self.engineref_list, self.lang, @@ -82,6 +85,7 @@ class SearchQuery: self.time_range, self.timeout_limit, self.external_bang, + self.redirect_to_first_result, ) def __eq__(self, other): @@ -94,6 +98,7 @@ class SearchQuery: and self.time_range == other.time_range and self.timeout_limit == other.timeout_limit and self.external_bang == other.external_bang + and self.redirect_to_first_result == other.redirect_to_first_result ) def __hash__(self): @@ -107,6 +112,7 @@ class SearchQuery: self.time_range, self.timeout_limit, self.external_bang, + self.redirect_to_first_result, ) ) @@ -121,4 +127,5 @@ class SearchQuery: self.timeout_limit, self.external_bang, self.engine_data, + self.redirect_to_first_result, ) |