mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-07 19:38:46 -05:00
[GH-ISSUE #23565] fix: search_notes returns empty results for multi-word queries #58680
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @jlgill on GitHub (Apr 10, 2026).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/23565
Expected Behavior
When a model calls
search_noteswith a multi-word query containing spaces and/or hyphens (e.g.,"to-do list reminders"), it should return notes whose title or content contains all of those terms somewhere in the text—regardless of where each term appears.Actual Behavior
search_notesreturns[]for every multi-word query. Only single-word or single hyphenated-term queries produce results.Steps to Reproduce
My To-Do List) and body content containing additional words likereminders,schedule, etc.search_notescall with multiple terms (e.g., "What does my to-do list say about reminders?").search_notestool call returns[]despite the note containing all search terms.to-doworks correctly and returns the note.Root cause: In
backend/open_webui/models/notes.py,search_notes()normalizes the query by stripping all hyphens and spaces from the entire string before performing a singleILIKEmatch:The hyphen-stripping logic was intended to let
todomatchto-do(single-term normalization), but applying it to the whole multi-word query concatenates all terms into one string that never appears contiguously in any note content.Fix: Split the query into individual terms, normalize each independently (strip hyphens), and require all terms to match somewhere in the title or content (AND semantics). Single-term behavior is unchanged.
Additionally, snippet extraction in
tools/builtin.pyattempts to find the entire multi-word query as one contiguous substring to center the preview—which also never matches for multi-word input. Fixed to locate the first matching individual term instead.Logs & Screenshots
Tool call trace from chat history (PostgreSQL):
After fix, validated directly against PostgreSQL and inside the container:
Additional Information
search_notes, which hits this SQL bug and returns empty.dev)backend/open_webui/models/notes.py,backend/open_webui/tools/builtin.pyInstallation Method: Docker
Open WebUI Version: v0.8.12
Operating System: Windows 11 / WSL2 + Docker Desktop
Browser: Chrome 136
@Classic298 commented on GitHub (Apr 10, 2026):
Stop spamming our discussions and issues, you commented this, and opened 2 issues and 5 discussions with the same exact text in 3 minutes or so. STOP. Final warning.