[GH-ISSUE #22697] issue: New files added AFTER enabling BYPASS_EMBEDDING_AND_RETRIEVAL are NOT indexed for vector search, causing inconsistent search results #106787

Closed
opened 2026-05-18 05:16:39 -05:00 by GiteaMirror · 1 comment
Owner

Originally created by @R-omk on GitHub (Mar 15, 2026).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/22697

Check Existing Issues

  • I have searched for any existing and/or related issues.
  • I have searched for any existing and/or related discussions.
  • I have also searched in the CLOSED issues AND CLOSED discussions and found no related items (your issue might already be addressed on the development branch!).
  • I am using the latest version of Open WebUI.

Installation Method

Docker

Open WebUI Version

v0.17.8

Ollama Version (if applicable)

No response

Operating System

Ubuntu 24.04

Browser (if applicable)

No response

Confirmation

  • I have read and followed all instructions in README.md.
  • I am using the latest version of both Open WebUI and Ollama.
  • I have included the browser console logs.
  • I have included the Docker container logs.
  • I have provided every relevant configuration, setting, and environment variable used in my setup.
  • I have clearly listed every relevant configuration, custom setting, environment variable, and command-line option that influences my setup (such as Docker Compose overrides, .env values, browser settings, authentication configurations, etc).
  • I have documented step-by-step reproduction instructions that are precise, sequential, and leave nothing to interpretation. My steps:
  • Start with the initial platform/version/OS and dependencies used,
  • Specify exact install/launch/configure commands,
  • List URLs visited, user input (incl. example values/emails/passwords if needed),
  • Describe all options and toggles enabled or changed,
  • Include any files or environmental changes,
  • Identify the expected and actual result at each stage,
  • Ensure any reasonably skilled user can follow and hit the same issue.

Expected Behavior

When BYPASS_EMBEDDING_AND_RETRIEVAL is enabled, ALL files in a knowledge base should behave consistently:

Option A (preferred): All files (old and new) should work the same way

  • If bypass is enabled → Full text mode for ALL files
  • query_knowledge_files() should either work with full text or return a clear error

Option B: Clear user feedback

  • If bypass is enabled, warn users that new files won't be indexed for vector search
  • Or provide option to manually re-index files with the bypass setting

Option C: Intelligent fallback

  • Tools like query_knowledge_files() should detect when BYPASS_EMBEDDING_AND_RETRIEVAL is enabled
  • Fall back to full text search instead of vector search
  • Return consistent results from all files

Actual Behavior

When BYPASS_EMBEDDING_AND_RETRIEVAL is enabled AFTER files have already been indexed:

  1. Old files (indexed BEFORE enabling the option):

    • Vector search works (if indices exist)
    • Files appear in query_knowledge_files() results
    • Content is accessible via vector embeddings
  2. New files (added AFTER enabling the option):

    • NO vectors are created (bypass skips save_docs_to_vector_db)
    • Files NEVER appear in query_knowledge_files() results
    • Full text is available ONLY if file is attached to chat

This creates confusion because:

  • Users expect all files in the knowledge base to work the same way
  • There's no warning that new files won't be indexed
  • Tools like query_knowledge_files() don't know about the bypass setting
  • Search results are silently incomplete

Steps to Reproduce

  1. Start Open WebUI with default configuration
  2. Create a knowledge base (e.g., "Test KB")
  3. Upload and index several files to "Test KB"
  4. Verify files are indexed and searchable via query_knowledge_files()
  5. Enable BYPASS_EMBEDDING_AND_RETRIEVAL = True in Settings > Documents
  6. Upload a NEW file to the SAME "Test KB"
  7. Use query_knowledge_files() to search for content from the new file
  8. Observe: The new file never appears in search results, only old files work

Logs & Screenshots

N/A - Not applicable to this issue (behavioral/UX bug, not a crash or error).

Code evidence:

In backend/open_webui/routers/retrieval.py:1819-1827:

if request.app.state.config.BYPASS_EMBEDDING_AND_RETRIEVAL:
    Files.update_file_data_by_id(file.id, {"status": "completed"}, db=db)
    Files.update_file_hash_by_id(file.id, hash, db=db)
    return {
        "status": True,
        "collection_name": None,  # ← No vector collection created
        "filename": file.filename,
        "content": text_content,
    }

In backend/open_webui/tools/builtin.py:1902-1908:

if collection_names:
    query_results = await query_collection(
        collection_names=collection_names,
        queries=[query],
        embedding_function=embedding_function,  # ← Always attempts vector search
        k=count,
    )

Note: The query_knowledge_files() function does not check BYPASS_EMBEDDING_AND_RETRIEVAL and always attempts vector search, causing incomplete results when some files lack vector indices.

Additional Information

No response

Originally created by @R-omk on GitHub (Mar 15, 2026). Original GitHub issue: https://github.com/open-webui/open-webui/issues/22697 ### Check Existing Issues - [x] I have searched for any existing and/or related issues. - [x] I have searched for any existing and/or related discussions. - [x] I have also searched in the CLOSED issues AND CLOSED discussions and found no related items (your issue might already be addressed on the development branch!). - [x] I am using the latest version of Open WebUI. ### Installation Method Docker ### Open WebUI Version v0.17.8 ### Ollama Version (if applicable) _No response_ ### Operating System Ubuntu 24.04 ### Browser (if applicable) _No response_ ### Confirmation - [x] I have read and followed all instructions in `README.md`. - [x] I am using the latest version of **both** Open WebUI and Ollama. - [x] I have included the browser console logs. - [x] I have included the Docker container logs. - [x] I have **provided every relevant configuration, setting, and environment variable used in my setup.** - [x] I have clearly **listed every relevant configuration, custom setting, environment variable, and command-line option that influences my setup** (such as Docker Compose overrides, .env values, browser settings, authentication configurations, etc). - [x] I have documented **step-by-step reproduction instructions that are precise, sequential, and leave nothing to interpretation**. My steps: - Start with the initial platform/version/OS and dependencies used, - Specify exact install/launch/configure commands, - List URLs visited, user input (incl. example values/emails/passwords if needed), - Describe all options and toggles enabled or changed, - Include any files or environmental changes, - Identify the expected and actual result at each stage, - Ensure any reasonably skilled user can follow and hit the same issue. ### Expected Behavior When `BYPASS_EMBEDDING_AND_RETRIEVAL` is enabled, ALL files in a knowledge base should behave consistently: **Option A (preferred):** All files (old and new) should work the same way - If bypass is enabled → Full text mode for ALL files - `query_knowledge_files()` should either work with full text or return a clear error **Option B:** Clear user feedback - If bypass is enabled, warn users that new files won't be indexed for vector search - Or provide option to manually re-index files with the bypass setting **Option C:** Intelligent fallback - Tools like `query_knowledge_files()` should detect when `BYPASS_EMBEDDING_AND_RETRIEVAL` is enabled - Fall back to full text search instead of vector search - Return consistent results from all files ### Actual Behavior When `BYPASS_EMBEDDING_AND_RETRIEVAL` is enabled **AFTER** files have already been indexed: 1. **Old files (indexed BEFORE enabling the option):** - Vector search works (if indices exist) - Files appear in `query_knowledge_files()` results - Content is accessible via vector embeddings 2. **New files (added AFTER enabling the option):** - NO vectors are created (bypass skips `save_docs_to_vector_db`) - Files NEVER appear in `query_knowledge_files()` results - Full text is available ONLY if file is attached to chat This creates confusion because: - Users expect all files in the knowledge base to work the same way - There's no warning that new files won't be indexed - Tools like `query_knowledge_files()` don't know about the bypass setting - Search results are silently incomplete ### Steps to Reproduce 1. Start Open WebUI with default configuration 2. Create a knowledge base (e.g., "Test KB") 3. Upload and index several files to "Test KB" 4. Verify files are indexed and searchable via `query_knowledge_files()` 5. Enable `BYPASS_EMBEDDING_AND_RETRIEVAL = True` in Settings > Documents 6. Upload a NEW file to the SAME "Test KB" 7. Use `query_knowledge_files()` to search for content from the new file 8. **Observe:** The new file never appears in search results, only old files work ### Logs & Screenshots **N/A** - Not applicable to this issue (behavioral/UX bug, not a crash or error). **Code evidence:** In `backend/open_webui/routers/retrieval.py:1819-1827`: ```python if request.app.state.config.BYPASS_EMBEDDING_AND_RETRIEVAL: Files.update_file_data_by_id(file.id, {"status": "completed"}, db=db) Files.update_file_hash_by_id(file.id, hash, db=db) return { "status": True, "collection_name": None, # ← No vector collection created "filename": file.filename, "content": text_content, } ``` In `backend/open_webui/tools/builtin.py:1902-1908`: ```python if collection_names: query_results = await query_collection( collection_names=collection_names, queries=[query], embedding_function=embedding_function, # ← Always attempts vector search k=count, ) ``` **Note:** The `query_knowledge_files()` function does not check `BYPASS_EMBEDDING_AND_RETRIEVAL` and always attempts vector search, causing incomplete results when some files lack vector indices. ### Additional Information _No response_
GiteaMirror added the bug label 2026-05-18 05:16:39 -05:00
Author
Owner

@tjbck commented on GitHub (Mar 15, 2026):

Intended behaviour.

<!-- gh-comment-id:4064024431 --> @tjbck commented on GitHub (Mar 15, 2026): Intended behaviour.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#106787