Add prefix matching to registry search
Search terms now automatically get a * suffix for prefix matching. E.g., searching "summ" matches "summarize", "summary", etc. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
85d1212c0d
commit
a46add05b7
|
|
@ -55,6 +55,7 @@ All notable changes to CmdForge will be documented in this file.
|
||||||
- Logs when AI review is skipped with reason
|
- Logs when AI review is skipped with reason
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
- **Registry search partial matching**: Search now supports prefix matching (e.g., "summ" matches "summarize")
|
||||||
- VERSION_EXISTS error showing after successful publish (made endpoint idempotent by checking config_hash)
|
- VERSION_EXISTS error showing after successful publish (made endpoint idempotent by checking config_hash)
|
||||||
- My Tools page listing every version separately (now consolidated by tool name)
|
- My Tools page listing every version separately (now consolidated by tool name)
|
||||||
- GUI not refreshing after publish dialog closes
|
- GUI not refreshing after publish dialog closes
|
||||||
|
|
|
||||||
|
|
@ -677,10 +677,15 @@ def create_app() -> Flask:
|
||||||
# Sanitize query for FTS5 - escape special characters that cause syntax errors
|
# Sanitize query for FTS5 - escape special characters that cause syntax errors
|
||||||
# FTS5 special chars: * " ( ) : ^ - NOT AND OR NEAR
|
# FTS5 special chars: * " ( ) : ^ - NOT AND OR NEAR
|
||||||
# For safety, we'll quote the entire query if it contains special chars
|
# For safety, we'll quote the entire query if it contains special chars
|
||||||
fts5_special = set('*"():^-')
|
fts5_special = set('"():^-')
|
||||||
if any(c in fts5_special for c in query_text) or query_text.upper() in ('NOT', 'AND', 'OR', 'NEAR'):
|
if any(c in fts5_special for c in query_text) or query_text.upper() in ('NOT', 'AND', 'OR', 'NEAR'):
|
||||||
# Escape double quotes and wrap in quotes for literal search
|
# Escape double quotes and wrap in quotes for literal search
|
||||||
query_text = '"' + query_text.replace('"', '""') + '"'
|
query_text = '"' + query_text.replace('"', '""') + '"'
|
||||||
|
else:
|
||||||
|
# Add prefix matching - append * to each word for partial matches
|
||||||
|
# e.g., "summ text" becomes "summ* text*" to match "summarize", "text", "texting"
|
||||||
|
words = query_text.split()
|
||||||
|
query_text = " ".join(word + "*" if not word.endswith("*") else word for word in words)
|
||||||
|
|
||||||
page, per_page, sort, order, error = parse_pagination("/tools/search", "downloads")
|
page, per_page, sort, order, error = parse_pagination("/tools/search", "downloads")
|
||||||
if error:
|
if error:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue