From 4e9c66ee25ed77858985765382f41d0cf22ea588 Mon Sep 17 00:00:00 2001 From: tanaka takashi Date: Tue, 20 Oct 2026 02:03:54 +0900 Subject: Improve web search region selection and normalize provider results Update ddgs to 9.16.0 and keep backend="auto" while preserving the LLM-facing query/max_results inputs and title/href/body result schema. Implementation: - Add OLLAMA_WEB_SEARCH_REGION with auto/us-en/jp-jp values, normalized configuration input, and a clear startup error for unsupported values. - In auto mode, detect kana after NFKC normalization and exclusion of URLs and site:/filetype: tokens. Select jp-jp for kana and us-en otherwise, without modifying the original query or sharing per-call region state. - Preserve href/url and body/snippet fallbacks and normalize None values. - Reject malformed HTTP(S) URLs without DNS lookups or extra requests. - Unwrap known Yahoo redirect URLs before excluding Bing aclick ads. - Represent missing and URL-only titles as empty strings rather than inventing titles from snippets. Preserve remaining provider order and allow fewer results after filtering, without additional searches. - Preserve provider exception propagation and identify ddgs in error logs. Coverage and documentation: - Add 72 regression cases for configuration, region routing, concurrency, public schemas, title/URL/ad boundaries, limits, and search_and_fetch continuation. Update existing provider mocks and log assertions. - Document the region environment setting and result semantics in both READMEs and tools-schema.md; update the changelog. - Keep only a short backend availability caveat in tools-schema.md and remove the temporary backend comparison, design, and validation docs. Validation: - pytest: 222 passed; ruff check . and mypy src/ passed. - uv lock --check and git diff --check passed. - Initial live acceptance: 56 searches plus 3 registry smoke checks; default-region auto succeeded 8/18 times and real ad filtering removed two ads. Stable relevance/title quality targets remain unmet because provider acquisition is unreliable. - Follow-up backend study: 234 comparative searches plus 3 Yahoo response diagnostics. Yahoo led individual backends at 9/18; restricted multi- backend combinations did not outperform the contemporaneous auto control. Authentication, access restrictions, temporary upstream failures, and Yahoo HTML/parser mismatches were observed. Do not claim search reliability is fixed or add backend configuration, custom retries, ranking changes, or challenge bypasses. Running app processes were not restarted; restart is needed to load the changes. --- README_ja.md | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'README_ja.md') diff --git a/README_ja.md b/README_ja.md index ccb8a39..088ac73 100644 --- a/README_ja.md +++ b/README_ja.md @@ -79,6 +79,17 @@ ollama-web | `OLLAMA_WEB_MCP_STDIO_ALLOWLIST` | 未設定 | stdio MCP で起動を許可する実行ファイル絶対パスのカンマ区切り | | `OLLAMA_WEB_MCP_HTTPS_ALLOWLIST` | 未設定 | remote HTTPS MCP 接続を許可するホスト名のカンマ区切り | | `OLLAMA_WEB_LANGUAGE` | `ja` | UI と LLM プロンプトの表示言語(`ja` または `en`) | +| `OLLAMA_WEB_SEARCH_REGION` | `auto` | 検索地域。`auto` / `us-en` / `jp-jp`。auto はかなを含むクエリを日本、それ以外を米国として検索 | + +検索は ddgs の `backend="auto"` を使用します。地域は内部で選び、LLM に公開する引数は +`query` と `max_results` のままです。判定では半角カナも正規化し、URL と `site:` / `filetype:` +のトークンを除外します。検索へ送る元クエリは変更しません。漢字だけのクエリは `us-en` +になるため、日本へ固定する場合は `jp-jp` を設定してください。UI 言語には連動せず、 +設定変更の反映にはアプリの再起動が必要です。不正な設定値では起動時にエラーになります。 + +構文上無効な URL と既知の Bing 広告リンクを除外し、空・URL 形式のタイトルは空文字にして +URL と要約を保持します。除外で件数が減っても追加検索は行いません。provider の失敗は +ツールエラーとして伝えます。 ### 多言語対応 -- cgit v1.2.3