-
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
[fix] engine woxikon.de - don't raise exception on empty result list #1681
Conversation
Will it raise an exception if the status code is higher than 500 though? Because that's useful for knowing if the server is down for example. Same goes for 429 if the server rate limit SearXNG. |
No .. searxng/searx/network/network.py Lines 239 to 247 in 6f28a69
I think the intention of searxng/searx/engines/wikipedia.py Lines 56 to 69 in 6f28a69
The drawback of a XPath engine (woxikon) is, that we can't implement a response handle. |
You don't get a status code like in https://github.com/searxng/searxng/pull/1682/files#diff-a34ea98196211e28f061d63a43f8056671e861d505000f965f341ea080fdbf13R61? |
Not sure I understand your question right .. XPath engines do not have a dedicated python module (to implement a engine specific HTTP error handle) and the Do you suggest a different implementation for XPath engines, to fetch only configured HTTP status code .. e.g.: - name: woxikon.de synonyme
engine: xpath
ignore_http_status:
- 404
- xxx @dalf what do you think about a ignore list for XPath engines? |
Oops I didn't see that it wasn't a dedicated python file for the engine. Your solution with |
I agree it should be implemented in xpath.py. By Otherwise if xpath.py returns an empty result for these HTTP status code, some alternative names : |
not parsing; the first intention was not to raise an exception on empty result lists. Some engines (like woxikon here in this PR) return a "404 Not Found" when they do not have a match for the search term. I think it is good to have an option in the configured xpath engine to fetch some HTTP status codes and return an empty result list.
True, the name could be improved, the ones you suggested I still do not like so much, but my suggestions are also not better: |
I've added a commit so unexpected HTTP statuses are not hidden. |
Woxikon expects a word in German, so with query "foo" the site finds nothing and respons a 404: httpx.HTTPStatusError: Client error '404 Not Found' \ for url 'https://synonyme.woxikon.de/synonyme/foo.php' [1] searxng#1543 (comment) Closes: searxng#1543 Suggested-by: @allendema [1] Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
no_result_for_http_status contains a list of HTTP status. These HTTP status are seen an empty result list. In other cases an exception is thrown as usual. Previously raise_for_httperror were ignoring all HTTP error, which make defective engines invisible in the stats.
9d8c524
to
dd0887b
Compare
Thanks a lot .. I rebased and going to merge after checks from CI have been passed. |
What does this PR do?
[fix] engine woxikon.de - don't raise exception on empty result list
Suggested-by: @allendema [1]
[1] #1543 (comment)
Why is this change important?
Woxikon expects a word in German, so with query "foo" the site finds nothing and respons a 404:
How to test this PR locally?
There should not be an 404 error any longer.
Related issues
Closes: #1543