Skip to content
This repository has been archived by the owner on Sep 7, 2023. It is now read-only.

Mod search query #2398

Merged
merged 2 commits into from Dec 20, 2020
Merged

Mod search query #2398

merged 2 commits into from Dec 20, 2020

Conversation

dalf
Copy link
Contributor

@dalf dalf commented Dec 18, 2020

What does this PR do?

See the messages of the two commits for more details:

  • remove the categories parameters of searx.search.SearchQuery.
    def __init__(self,
    query: str,
    engineref_list: typing.List[EngineRef],
    categories: typing.List[str],
    lang: str,
    safesearch: int,
    pageno: int,
    time_range: typing.Optional[str],
    timeout_limit: typing.Optional[float]=None,
    external_bang: typing.Optional[str]=None):
  • searx.search.SearchQuery: except query and engineref_list, other parameters are optional.
  • searx.search.EngineRef: remove the from_bang parameter. This parameter is set True when the user search using a bang. In this case the category is forced to 'none', but the category is already 'none':
    self.enginerefs.append(EngineRef(engine_name, 'none', True))

Why is this change important?

For #1559 , the PR allows to create SearchQuery more easily.

How to test this PR locally?

  • search using a bang
  • search with different engines
  • test standalone_searx

Author's checklist

Related issues

@dalf dalf added the core label Dec 18, 2020
The categories parameter is useless in the constructor:
it is always the categories from the EngineRef.

The categories becomes a property.
from_bang is True when the user query contains a bang.
In this case the category is also set to 'none'.

from_bang only usage was in searx.webadapter.parse_specific :
if from_bang is True, then the EngineRef category is ignored and force to 'none'.

This commit also removes the searx.webadapter.parse_sepecific function.
@dalf dalf merged commit 04447f8 into searx:master Dec 20, 2020
@dalf dalf deleted the mod-search-query branch December 20, 2020 08:32
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant