Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: google engine with specified "language: it_IT" #384

Closed
paolobasso99 opened this issue Oct 5, 2021 · 3 comments · Fixed by #386
Closed

Bug: google engine with specified "language: it_IT" #384

paolobasso99 opened this issue Oct 5, 2021 · 3 comments · Fixed by #386
Labels
bug Something isn't working

Comments

@paolobasso99
Copy link
Contributor

Version of SearXNG, commit number if you are using on master branch and stipulate if you forked SearXNG
Repository: https://github.com/searxng/searxng
Branch: master
Version: 1.0.0-885-feb2d4dd

How did you install SearXNG?

I used searxng-docker.

What happened?

I tried to set up the Google engine with language: it_IT but it crashes.
How To Reproduce

Add this engine:

-  name: google italian
   engine: google
   shortcut: goit
   language: it_IT
   use_mobile_ui: false

and try to perform a search.

Expected behavior

Results from the google engine with a specified language.

Additional context
I followed the guide in the wiki to add multilingual search to the letter but it does not work.

Technical report

Error

  • Error: AttributeError
  • Percentage: 100
  • Parameters: ()
  • File name: searx/engines/google.py:232
  • Function: get_lang_info
  • Code: ret_val['params']['hl'] = lang_list.get(lang_country, language)
@paolobasso99 paolobasso99 added the bug Something isn't working label Oct 5, 2021
@paolobasso99
Copy link
Contributor Author

I have also tried it-IT, it and italian but none of these works.

return42 added a commit to return42/searxng that referenced this issue Oct 6, 2021
The key of the dictionary 'searx.data.ENGINES_LANGUAGES' is the *engine name*
configured in settings.xml.  When multiple engines are configured to use the
same engine::

    - name: google
      engine: google
      ...

    - name: google italian
      engine: google
      language: it
      ...

There exists no entry for ENGINES_LANGUAGES[engine.name] (e.g. 'google
italian').  This issue can be solved by recreate the ENGINES_LANGUAGES::

    make data.languages

But this is nothing an SearXNG admin would like to do, since this only doubles
entries in ENGINES_LANGUAGES.  With this patch, if engine.name fails,
ENGINES_LANGUAGES[engine.engine] is used (e.g. 'google' for the engine named
'google italian').

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Closes: searxng#384
return42 added a commit to return42/searxng that referenced this issue Oct 6, 2021
The key of the dictionary 'searx.data.ENGINES_LANGUAGES' is the *engine name*
configured in settings.xml.  When multiple engines are configured to use the
same engine::

    - name: google
      engine: google
      ...

    - name: google italian
      engine: google
      language: it
      ...

There exists no entry for ENGINES_LANGUAGES[engine.name] (e.g. 'google
italian').  This issue can be solved by recreate the ENGINES_LANGUAGES::

    make data.languages

But this is nothing an SearXNG admin would like to do, since this only doubles
entries in ENGINES_LANGUAGES.  With this patch, if engine.name fails,
ENGINES_LANGUAGES[engine.engine] is used (e.g. 'google' for the engine named
'google italian').

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Closes: searxng#384
@return42
Copy link
Member

return42 commented Oct 6, 2021

You can fix the issue by:

make data.languages

Or you approve #386 ...

return42 added a commit to return42/searxng that referenced this issue Oct 6, 2021
The key of the dictionary 'searx.data.ENGINES_LANGUAGES' is the *engine name*
configured in settings.xml.  When multiple engines are configured to use the
same origin engine (e.g. `engine: google`)::

    - name: google
      engine: google
      use_mobile_ui: false
      ...

    - name: google italian
      engine: google
      use_mobile_ui: false
      language: it
      ...

    - name: google mobile ui
      engine: google
      shortcut: gomui
      use_mobile_ui: true

There exists no entry for ENGINES_LANGUAGES[engine.name] (e.g. `name: google
mobile ui` or `name: google italian`).  This issue can be solved by recreate the
ENGINES_LANGUAGES::

    make data.languages

But this is nothing an SearXNG admin would like to do when just configuring
additional engines, since this just doubles entries in ENGINES_LANGUAGES and
BTW: `make data.languages` has various external requirements which might be not
installed or not available, on a production host.

With this patch, if engine.name fails, ENGINES_LANGUAGES[engine.engine] is used
to get the engine.supported_languages (e.g. `google` for the engine named
`google mobile`).

For an engine, when there is `language: ...` in the YAML settings, the engine
supports only one language, in this case engine.supported_languages should
contains this value defined in settings.yml (e.g. `it` for the engine named
`google italian`).

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Closes: searxng#384
return42 added a commit to return42/searxng that referenced this issue Oct 7, 2021
The key of the dictionary 'searx.data.ENGINES_LANGUAGES' is the *engine name*
configured in settings.xml.  When multiple engines are configured to use the
same origin engine (e.g. `engine: google`)::

    - name: google
      engine: google
      use_mobile_ui: false
      ...

    - name: google italian
      engine: google
      use_mobile_ui: false
      language: it
      ...

    - name: google mobile ui
      engine: google
      shortcut: gomui
      use_mobile_ui: true

There exists no entry for ENGINES_LANGUAGES[engine.name] (e.g. `name: google
mobile ui` or `name: google italian`).  This issue can be solved by recreate the
ENGINES_LANGUAGES::

    make data.languages

But this is nothing an SearXNG admin would like to do when just configuring
additional engines, since this just doubles entries in ENGINES_LANGUAGES and
BTW: `make data.languages` has various external requirements which might be not
installed or not available, on a production host.

With this patch, if engine.name fails, ENGINES_LANGUAGES[engine.engine] is used
to get the engine.supported_languages (e.g. `google` for the engine named
`google mobile`).

For an engine, when there is `language: ...` in the YAML settings, the engine
supports only one language, in this case engine.supported_languages should
contains this value defined in settings.yml (e.g. `it` for the engine named
`google italian`).

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Closes: searxng#384
@dalf dalf closed this as completed in #386 Oct 7, 2021
@return42
Copy link
Member

return42 commented Oct 7, 2021

@paolobasso99 the issue reported is fixed, update your instance and just uncomment ..

searxng/searx/settings.yml

Lines 604 to 608 in 7246d62

# - name: google italian
# engine: google
# shortcut: goit
# use_mobile_ui: false
# language: it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants