Skip to content

Bug: Tag search syntax 'tag:tagname' returns empty results #354

Description

@phernandez

Summary

Tag-specific search syntax tag:tagname returns empty results even when notes with those tags exist in the knowledge base.

Severity

Medium - Reduces tag-based discoverability but text search workaround is available

Reproduction Steps

  1. Create notes with tags (e.g., tags: ["tier1", "test"])
  2. Verify notes exist via text search: search_notes(query="tier1") ✓ Returns results
  3. Execute search with tag syntax: search_notes(query="tag:tier1")
  4. Observe empty results: {"results":[],"current_page":1,"page_size":10}

Expected Behavior

search_notes(query="tag:tier1") should return all notes that have "tier1" in their tags array

Actual Behavior

Query returns empty results even though 3+ notes with the tag exist

Test Evidence

# Created 3 notes with tier1 tag:
# - Test Note Basic Functionality
# - Test Note Unicode 📝✨🚀  
# - Test Root Folder Note

# Text search works:
search_notes(query="tier1", project="test-project")
# Returns results ✓

# Tag search fails:
search_notes(query="tag:tier1", project="test-project")
# Returns [] ✗

Environment

  • Version: 0.15.0
  • Platform: macOS Darwin 24.6.0
  • Discovered during: Live comprehensive testing session 2025-10-13
  • Test project: basic-memory-testing-2025-10-13-073211

Impact

  • User Experience: Medium - Reduces tag-based discoverability
  • Functionality: Text search workaround available (see below)
  • Data Integrity: No impact
  • Production Blocking: No

Workaround

Use text search for tag names instead of tag-specific syntax:

# Instead of: search_notes(query="tag:tier1", project="my-project")
# Use: search_notes(query="tier1", project="my-project")

Recommended Fix

Review tag search query parsing in the search endpoint. Check if the tag: prefix is being stripped/parsed correctly before querying the tags field in the database.

Related Code Locations

  • Likely: src/basic_memory/api/routers/search.py
  • Database: SQLite FTS5 configuration for tags field
  • Schema: Tag indexing in src/basic_memory/models/

Additional Context

  • Discovered during comprehensive v0.15.0 testing
  • Part of 19-test suite with 95% pass rate
  • Does not block production deployment
  • All other search functionality working correctly
  • Documentation: Test project contains full bug report at bug-reports/Bug Report - Tag Search Not Working.md

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions