Hacking searx

This revision is from 2024/08/06 22:12. You can Restore it.

Open searx/settings.yml and add a new preference option.

user_preferences:

test_option:

type: bool

default: false

description: "Enable test output"

Find the place to install it... for instance, searx/search/search.py

Find the function where search results are processed (e.g., _get_search_result_container).

Add logic...

def _get_search_result_container(self, request, selected_engines):

if request.preferences['test_option']:

results.append({'title': 'Test Output', 'content': 'this is a test'})

Update the preferences UI: searx/templates/preferences.html.

Add a new checkbox for the test_option.

<div class="form-check">

<input class="form-check-input" type="checkbox" name="test_option" id="test_option" {% if preferences.test_option %}checked{% endif %}>

<label class="form-check-label" for="test_option">

Enable test output

</label>

</div>

  

📝 📜 ⏱️ ⬆️