feat: Support tag: query shorthand in search - #535
Conversation
Signed-off-by: phernandez <paul@basicmachines.co>
Signed-off-by: phernandez <paul@basicmachines.co>
|
Claude finished @phernandez's task in 2m 18s —— View job Code Review: Support tag: query shorthand in searchI've completed a thorough review of this PR against the Basic Memory team checklist. SummaryThis PR implements Files changed:
Team Checklist Results✅ Code Quality & Standards
❌ Missing: Literate programming comments The new code at
Example of what's needed: # Support tag:<tag> shorthand by mapping to tags filter
if query.text:
text = query.text.strip()
# Trigger: query starts with "tag:" prefix (case-insensitive)
# Why: provide convenient shorthand for tag filtering without verbose metadata syntax
# Outcome: transforms to tags filter, drops text search to avoid empty results
if text.lower().startswith("tag:"):
# Split on both commas and whitespace to support: tag:tier1,alpha or tag:tier1 alpha
tag_values = re.split(r"[,\s]+", text[4:].strip())
tags = [t for t in tag_values if t]
if tags:
query.tags = tags
# Outcome: text search is removed since tag prefix consumed entire query
query.text = NoneAdd literate programming comments →
|
|
Claude finished @phernandez's task in 2m 35s —— View job Code Review: Support tag: query shorthand in searchI've completed a thorough review of this PR against the Basic Memory team checklist. The implementation is functionally correct and has good test coverage, but there are some important issues that need to be addressed before merging. SummaryThis PR implements Files changed:
Team Checklist Results✅ Code Quality & Standards
❌ CRITICAL: Missing literate programming comments Per CLAUDE.md lines 87-91, conditionals that materially change behavior require decision point comments with Trigger/Why/Outcome. The code at What's needed: # Support tag:<tag> shorthand by mapping to tags filter
if query.text:
text = query.text.strip()
# Trigger: query starts with "tag:" prefix (case-insensitive)
# Why: provide convenient shorthand for tag filtering without verbose metadata syntax
# Outcome: transforms to tags filter, drops text search to avoid empty results
if text.lower().startswith("tag:"):
# Split on both commas and whitespace: "tag:tier1,alpha" or "tag:tier1 alpha"
tag_values = re.split(r"[,\s]+", text[4:].strip())
tags = [t for t in tag_values if t]
if tags:
query.tags = tags
# Outcome: text search removed since tag prefix consumed entire query
query.text = None
|

Summary
tag:<value>query prefix to tags metadata filter so tag searches work againTesting