mirror of
https://github.com/open-webui/open-webui.git
synced 2026-09-16 23:43:03 +00:00
feat: knowledge extend search to file content
Enhance knowledge search to match not only file titles but also the underlying file content. This improves search coverage and allows users to locate entries based on full content, not just metadata. Note: Future improvement could include diacritic-insensitive search (e.g. PostgreSQL unaccent) to better support languages such as Greek.
This commit is contained in:
parent
4e2240aada
commit
d570c6f518
1 changed files with 5 additions and 1 deletions
|
|
@ -467,7 +467,11 @@ class KnowledgeTable:
|
|||
if filter:
|
||||
query_key = filter.get('query')
|
||||
if query_key:
|
||||
stmt = stmt.filter(or_(File.filename.ilike(f'%{query_key}%')))
|
||||
if db.bind.dialect.name == 'sqlite':
|
||||
stmt_content = File.data['content'].ilike(f'%{query_key}%')
|
||||
else:
|
||||
stmt_content = File.data.op('->>')('content').ilike(f'%{query_key}%')
|
||||
stmt = stmt.filter(or_(File.filename.ilike(f'%{query_key}%'), stmt_content))
|
||||
|
||||
view_option = filter.get('view_option')
|
||||
if view_option == 'created':
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue