@traqr/memory 0.2.7 → 0.2.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/setup.sql +7 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@traqr/memory",
3
- "version": "0.2.7",
3
+ "version": "0.2.8",
4
4
  "description": "Persistent memory for AI agents. Multi-strategy retrieval (semantic + BM25 + RRF), 3-zone cosine triage, type-aware lifecycle, entity canonicalization. Postgres + pgvector.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
package/setup.sql CHANGED
@@ -751,9 +751,14 @@ LANGUAGE plpgsql AS $$
751
751
  DECLARE
752
752
  tsquery_en tsquery;
753
753
  tsquery_simple tsquery;
754
+ or_query TEXT;
754
755
  BEGIN
755
- tsquery_en := plainto_tsquery('english', p_query_text);
756
- tsquery_simple := plainto_tsquery('simple', p_query_text);
756
+ -- Split query words into OR terms for better recall.
757
+ -- "engagement ring proposal" -> "engagement | ring | proposal"
758
+ -- ts_rank_cd naturally ranks docs with MORE matching terms higher.
759
+ or_query := regexp_replace(trim(p_query_text), '\s+', ' | ', 'g');
760
+ tsquery_en := to_tsquery('english', or_query);
761
+ tsquery_simple := to_tsquery('simple', or_query);
757
762
 
758
763
  RETURN QUERY
759
764
  SELECT