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

Filtering results in a plugin (on_result hook) possible? #1737

Open
arendjantetteroo opened this issue Nov 4, 2019 · 0 comments

Comments

@arendjantetteroo
Copy link

@arendjantetteroo arendjantetteroo commented Nov 4, 2019

I'm working on a plugin that is supposed to filter the results from the engines based on certain criteria i can check in the plugin.

I use the on_result hook, which works fine for changing results as seen in the remove_tracker plugin, but it seems i can not remove certain results in this hook.

Is there a way to make this happen i did not see?
It would be nice if we could just add a result['filtered'] = True or do a return null in the on_result hook to let results disappear from the results page.

I currently solved it with a workaround by specifying a different template with a "filtered" = true on the result, which if it's true is not shown by this template. However, this means that my plugin needs to provide a template for each theme there is in searx to let this work for all themes.

Any hints?

Current prototype code is here: https://github.com/thegreenwebfoundation/searx/pull/1/files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.