Skip to content

fix(searxng): tune engine weights, pool, timeouts, add mojeek+stract#607

Merged
DaRacci merged 1 commit into
DaRacci:masterfrom
RacciDev-Bot:fix/searxng-engine-weights
Jul 11, 2026
Merged

fix(searxng): tune engine weights, pool, timeouts, add mojeek+stract#607
DaRacci merged 1 commit into
DaRacci:masterfrom
RacciDev-Bot:fix/searxng-engine-weights

Conversation

@RacciDev-Bot

Copy link
Copy Markdown
Contributor

Summary

Tune SearXNG configuration for a single-user instance behind Cloudflare Tunnel, primarily consumed by AI agent search tools (Hermes, Open WebUI).

Changes

Performance / Connection Tuning

  • pool_maxsize: 20 → 8 (20 keep-alive connections per engine is excessive for single-user; 8 handles concurrent subagent searches comfortably)
  • enable_http2: now explicit (true)
  • keepalive_expiry: now explicit (5.0s)

Engine Suspension Times

Defaults were absurd for a private instance (recaptcha: 7 days, cloudflare: 15 days). Reduced:

  • recaptcha_SearxEngineCaptcha: 604800s → 86400s (1 day)
  • cf_SearxEngineCaptcha: 1296000s → 86400s (1 day)
  • cf_SearxEngineAccessDenied: 86400s → 3600s (1 hour)
  • SearxEngineCaptcha: 86400s → 3600s (1 hour)
  • SearxEngineTooManyRequests: 3600s → 1800s (30 min)

New Engines

  • Mojeek (weight 1.0): UK-based independent crawler engine with its own index since 2004 — zero overlap with Google/Bing results
  • Stract (weight 0.8): Danish open-source engine with novel ranking, de-ranks tracker-heavy sites, independent index

QoL

  • Enable autocomplete = "duckduckgo" (was disabled)
  • Enable favicon_resolver = "duckduckgo" (was commented out)

Not Changed

  • public_instance stays false — this controls searx.space listing and public instance badges, not reachability
  • link_token stays false — would throttle API consumers (Hermes subagents, Open WebUI) that don't go through the HTML UI
  • image_proxy not enabled — unnecessary memory/bandwidth cost for solo user

@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Added DuckDuckGo autocomplete suggestions to search.
    • Enabled DuckDuckGo favicon resolution for results.
    • Added Mojeek and Stract as additional search engines.
    • Set the default search language to auto-detect.
  • Improvements

    • Improved search resilience when engines hit access denied, CAPTCHA, or rate limits via suspension rules.
    • Optimised outbound connection handling (smaller pool, HTTP/2, shorter keepalive expiry).
    • Refined search engine weighting to improve result selection.

Walkthrough

SearXNG configuration enables DuckDuckGo discovery features, switches language selection to automatic, defines engine suspension periods, updates outgoing HTTP settings, and adds Mojeek and Stract engines.

Changes

SearXNG configuration

Layer / File(s) Summary
Search discovery and failure handling
hosts/server/nixcloud/search.nix
DuckDuckGo autocomplete and favicon resolution are enabled, the default language changes to automatic, and suspension durations are configured for several engine failure conditions.
Outgoing request pool settings
hosts/server/nixcloud/search.nix
The connection pool size is set to 8, HTTP/2 is enabled, and keepalive expiry is set to 5 seconds.
Web search engine entries
hosts/server/nixcloud/search.nix
Mojeek and Stract are added with engine names, shortcuts, categories, and weights.

Estimated code review effort: 2 (Simple) | ~15 minutes

Possibly related PRs

Poem

A rabbit hops through search results bright,
New engines join the search tonight.
Connections keep alive and keen,
Failures pause in times serene.
“Nixcloud,” I cheer, “what a tidy scene!”

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main SearXNG tuning changes and mentions the new Mojeek and Stract engines.
Description check ✅ Passed The description directly explains the SearXNG tuning, suspension, and engine changes in the PR.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
✨ Simplify code
  • Create PR with simplified code

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@DaRacci DaRacci enabled auto-merge (rebase) July 10, 2026 12:46
- Lower pool_maxsize 20→8 for single-user + subagent usage
- Lower engine suspension times (recaptcha 7d→1d, cf 15d→1d)
- Enable autocomplete and favicon_resolver (duckduckgo)
- Add mojeek (w=1.0) and stract (w=0.8) engines for result diversity
- Add explicit enable_http2 and keepalive_expiry settings
auto-merge was automatically disabled July 11, 2026 06:08

Head branch was pushed to by a user without write access

@RacciDev-Bot RacciDev-Bot force-pushed the fix/searxng-engine-weights branch from bac598d to a404b34 Compare July 11, 2026 06:08

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
hosts/server/nixcloud/search.nix (1)

53-201: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Update the SearXNG docs under docs/

The hosts/server/nixcloud/search.nix changes don’t appear to be reflected in the docs tree; docs/search.nix is the search site module, not service documentation. Add the matching SearXNG/nixcloud doc update alongside this config change.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@hosts/server/nixcloud/search.nix` around lines 53 - 201, Update the relevant
SearXNG/nixcloud documentation under docs/ to match the configuration introduced
in search.nix, including search settings, suspended_times, UI/outgoing options,
plugins, hostname rules, categories, and engines. Do not modify docs/search.nix,
since it is the search site module rather than service documentation.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@hosts/server/nixcloud/search.nix`:
- Around line 53-201: Update the relevant SearXNG/nixcloud documentation under
docs/ to match the configuration introduced in search.nix, including search
settings, suspended_times, UI/outgoing options, plugins, hostname rules,
categories, and engines. Do not modify docs/search.nix, since it is the search
site module rather than service documentation.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 219cc61e-6414-4d5f-b651-ec5a3936f53a

📥 Commits

Reviewing files that changed from the base of the PR and between bac598d and a404b34.

📒 Files selected for processing (1)
  • hosts/server/nixcloud/search.nix
📜 Review details
⏰ Context from checks skipped due to timeout. (1)
  • GitHub Check: CodeRabbit
🧰 Additional context used
📓 Path-based instructions (3)
**/*.nix

📄 CodeRabbit inference engine (.opencode/skills/code-style-nix)

**/*.nix: Follow Nix code style conventions and best practices
Use consistent indentation and formatting in Nix configuration files
Follow established patterns for module organization in home-manager configurations

**/*.nix: Format code and check syntax using nix fmt
Evaluate Nix expressions without building using nix eval with the target configuration path
Format specific Nix files or directories using nix fmt followed by the file or directory path
Use --show-trace flag with nix build or nix eval commands to diagnose evaluation errors
For infinite recursion errors in Nix builds, check for circular imports or conflicting option definitions

**/*.nix: Use builtins.trace to add trace statements and inspect values during Nix evaluation (format: builtins.trace "message: ${toString var}" var)
Use builtins.toJSON to convert complex Nix attribute sets to JSON for easier inspection during evaluation
Check for circular imports between modules and option definitions that depend on themselves to resolve infinite recursion errors
Verify attribute names are correct and imports are complete when debugging 'attribute not found' errors in Nix
Check option type definitions and ensure provided values match the expected type to resolve type mismatch errors
Read assertion messages and provide required configuration values when assertion failures occur in NixOS modules

**/*.nix: Store sensitive data in secrets.yaml encrypted with sops instead of hardcoding passwords, API keys, or tokens in plain text
Declare sops secrets with proper owner, group, and mode attributes; use restrictive modes like 0400 for secrets files
Set restartUnits or reloadUnits for sops secrets declarations so services that depend on secrets are restarted when secrets change
Use config.sops.placeholder in sops templates instead of directly interpolating secret paths in multi-secret templates
Do not pass secrets as environment variables in plain Nix; use environmentFile or...

Files:

  • hosts/server/nixcloud/search.nix
hosts/server/**/*.nix

📄 CodeRabbit inference engine (.opencode/skills/project-structure/SKILL.md)

Server machine-specific NixOS configs should be placed in hosts/server/<machine>/

Files:

  • hosts/server/nixcloud/search.nix
hosts/**/*.nix

📄 CodeRabbit inference engine (.opencode/skills/modules/SKILL.md)

Enable NixOS modules in host configuration using the module's declared option, such as services.myService.enable = true.

Files:

  • hosts/server/nixcloud/search.nix
🧠 Learnings (5)
📚 Learning: 2026-04-13T14:02:32.760Z
Learnt from: DaRacci
Repo: DaRacci/nix-config PR: 546
File: hosts/server/nixdev/default.nix:18-18
Timestamp: 2026-04-13T14:02:32.760Z
Learning: When configuring NixOS Docker via `virtualisation.docker.daemon.settings`, it is valid to set `storage-driver = "overlayfs"` (do not flag it as an invalid Docker storage-driver). Use `overlayfs` specifically for Docker Engine 29+ and/or when the containerd snapshotter integration is enabled (`virtualisation.docker.features.containerd-snapshotter = true`). Treat this as the containerd snapshotter name for OverlayFS, distinct from the legacy `overlay2` classic Docker storage driver.

Applied to files:

  • hosts/server/nixcloud/search.nix
📚 Learning: 2026-05-01T10:02:55.261Z
Learnt from: DaRacci
Repo: DaRacci/nix-config PR: 544
File: modules/nixos/core/sops.nix:49-53
Timestamp: 2026-05-01T10:02:55.261Z
Learning: In this nix-config repo, when declaring `sops.secrets` in Nix files, avoid explicitly setting `owner = "root"` and/or `group = "root"` if the intended ownership is root. `sops-nix` defaults `sops.secrets` to `root:root`, so adding these fields explicitly is redundant boilerplate.

Applied to files:

  • hosts/server/nixcloud/search.nix
📚 Learning: 2026-05-01T14:14:49.691Z
Learnt from: DaRacci
Repo: DaRacci/nix-config PR: 544
File: modules/nixos/core/gaming.nix:119-119
Timestamp: 2026-05-01T14:14:49.691Z
Learning: When configuring the NixOS `wivrn` module option `services.wivrn.config.json.application`, pass the raw package/derivation (e.g., `pkgs.wayvr`) rather than converting it to a string executable path (e.g., `lib.getExe pkgs.wayvr`). The upstream module expects a list of derivations/packages (it internally `toList`s the value, asserts the first element is a derivation, and then resolves the executable internally). Code review should not recommend changing `pkgs.wayvr` to `lib.getExe pkgs.wayvr` for this option.

Applied to files:

  • hosts/server/nixcloud/search.nix
📚 Learning: 2026-05-20T13:12:46.610Z
Learnt from: DaRacci
Repo: DaRacci/nix-config PR: 546
File: docs/site.nix:127-127
Timestamp: 2026-05-20T13:12:46.610Z
Learning: In DaRacci/nix-config, treating `passthru.discovery = false` as a known repo-wide convention to exclude a derivation from automated flake discovery/package CI. Do not require or flag an inline explanatory comment specifically for the absence of a comment when `passthru.discovery = false` is set.

Applied to files:

  • hosts/server/nixcloud/search.nix
📚 Learning: 2026-06-28T05:00:06.970Z
Learnt from: DaRacci
Repo: DaRacci/nix-config PR: 599
File: hosts/server/nixai/mnemosyne.nix:6-11
Timestamp: 2026-06-28T05:00:06.970Z
Learning: In this repo’s Nix host configuration, for `sops.secrets.<name>` declarations managed by `sops-nix`, avoid explicitly setting `mode = "0400"` when you are not overriding `sops-nix`’s default secret permissions. `sops-nix` already defaults decrypted secret files to root ownership with mode `0400`, so an explicit `mode = "0400"` is typically redundant. Only set `mode` when you truly need non-default permissions (or you have config that changes the module defaults).

Applied to files:

  • hosts/server/nixcloud/search.nix
🔇 Additional comments (4)
hosts/server/nixcloud/search.nix (4)

53-56: Discovery settings look good.

Enabling DuckDuckGo autocomplete and favicon resolution, switching default_lang to "auto", and setting autocomplete_min = 4 are all sensible choices for a single-user instance. The 4-character minimum reduces unnecessary autocomplete requests.


66-76: Suspension times are well-tuned for a private instance.

The comment clearly explains the rationale — defaults of 7–15 days for captcha/access-denied are excessive when you control the instance. The chosen values (1 hour for generic captcha, 30 min for rate limits, 24 hours for Cloudflare/recaptcha variants) provide a good balance between giving engines time to recover and not leaving them suspended for unnecessarily long periods.


97-99: Outgoing pool settings align with PR objectives.

pool_maxsize = 8 is appropriate for a single-user instance (reducing from 20), enable_http2 = true improves connection efficiency, and keepalive_expiry = 5.0 matches the stated 5-second target.


157-201: Engine weights and new entries are consistent with stated objectives.

Weights match the commit summary: Bing 0.5, DuckDuckGo 1.2, Google 1.5, Brave 1.2, Startpage 1.3. Mojeek (1.0) and Stract (0.8) are properly configured with list-format categories = [ "general" ], consistent with the other engine entries. Stract's lower weight is reasonable given it's a newer, less established engine.

@DaRacci DaRacci merged commit fcea73c into DaRacci:master Jul 11, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants