Class: ClaudeMemory::Index::IndexQuery
- Inherits:
-
Object
- Object
- ClaudeMemory::Index::IndexQuery
- Defined in:
- lib/claude_memory/index/index_query.rb
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(store, options) ⇒ IndexQuery
constructor
A new instance of IndexQuery.
Constructor Details
#initialize(store, options) ⇒ IndexQuery
Returns a new instance of IndexQuery.
6 7 8 9 10 |
# File 'lib/claude_memory/index/index_query.rb', line 6 def initialize(store, ) @store = store @options = @fts = LexicalFTS.new(store) end |
Instance Method Details
#execute ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/claude_memory/index/index_query.rb', line 12 def execute # Query 1: Search FTS for content IDs (1 query) content_ids = search_content return [] if content_ids.empty? # Query 2: Batch fetch ALL provenance records (1 query, not N!) provenance_by_content = fetch_all_provenance(content_ids) # Pure logic: collect fact IDs (no I/O) fact_ids = IndexQueryLogic.collect_fact_ids( provenance_by_content, content_ids, @options.limit ) return [] if fact_ids.empty? # Query 3: Batch fetch facts with entities (1 query, not N!) fetch_facts(fact_ids) end |