Skip to content

Escape wildcard characters in free-text memory search #26

Description

@laceyp99

Summary

q search currently passes user input directly into a LIKE pattern, so % and _ act as wildcards instead of literal characters.

Steps to reproduce

  1. Create memories with content foo_bar and fooXbar.
  2. Query GET /memories?q=foo_bar.

Expected behavior

Only the literal foo_bar record should match.

Actual behavior

Both records match because _ is treated as a wildcard.

Relevant code

  • app/storage.py:174-177
  • README.md:146-148
  • docs/data_object_schema.md:287-291

Suggested fix

Escape % and _ before building the LIKE pattern, or use an ESCAPE clause.

Tests

Add a regression test covering literal % and _ in q values.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent-pr-openedMy custom label that signifies an agent has opened a PR on this issue.bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions