-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[mod] searx.engines.__init__: refactoring #116
Conversation
I think setting the headers to ... ja-JP searxng/searx/engines/__init__.py Lines 131 to 134 in 737f5f0
is questionable. It comes from 9b6ffed PR-searx 2602 / there is a detailed description I do not have fully understand right now, but since I have updated my instance, sometimes (rare) I observe japan results in my german queries . |
? |
e4a3166
to
4426bc4
Compare
Oops .. my fail .. I have sometims (rare) japan results in my german queries, I thought it could be related to this implementation, but now I see it is totaly unrelated .. forget my comment. |
Currently,
looking at searxng/searx/engines/sqlite.py Lines 25 to 30 in 8567292
it can be rewritten: query_str = None # instead of query_str = ""
def init(engine_settings):
if not query_str.lower().startswith('select '): # here `searx.engines.load_engine()` will copy the value from settings.yml to the variable
raise ValueError('only SELECT query is supported')
--> I suggest |
Loading an engine should never exit the application. Instead of exit, return None. BTW: add documentation and normalize indentation (no functional change) Suggested-by: @dalf searxng#116 (comment) Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Loading an engine should never exit the application. Instead of exit, return None. BTW: add documentation and normalize indentation (no functional change) Suggested-by: @dalf searxng#116 (comment) Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! .. lets merge ..
Loading an engine should not exit the application (*). Instead of exit, return None. (*) RuntimeError still exit the application: syntax error, etc... BTW: add documentation and normalize indentation (no functional change) Suggested-by: @dalf #116 (comment) Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
- document namespace: searx.engines - move docs/dev/xpath_engine.rst -> docs/src/searx.engines.xpath.rst Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
sphinx.ext.viewcode won't highlight when 'highlight_language' [1] is set to string 'none' [2] [1] https://www.sphinx-doc.org/en/master/usage/extensions/viewcode.html [2] https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-highlight_language Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
41ea099
to
15de870
Compare
try: | ||
engine = load_module(engine_module + '.py', engine_dir) | ||
engine = load_module(engine_module + '.py', ENGINE_DIR) | ||
except (SyntaxError, KeyboardInterrupt, SystemExit, SystemError, ImportError, RuntimeError): | ||
logger.exception('Fatal exception in engine "{}"'.format(engine_module)) | ||
sys.exit(1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still one sys.exit(1)
here otherwise it is possible to have a syntax error in the engine code (it had happened before).
What does this PR do?
See comments
Why is this change important?
How to test this PR locally?
Author's checklist
Related issues