Class: KairosMcp::VectorSearch::Base
- Inherits:
-
Object
- Object
- KairosMcp::VectorSearch::Base
- Defined in:
- lib/kairos_mcp/vector_search/base.rb
Overview
Abstract base class for vector search implementations
Provides a common interface for both semantic search (with RAG) and fallback search (regex-based).
Direct Known Subclasses
Instance Method Summary collapse
-
#add(id, text, metadata: {}) ⇒ Boolean
Add a document to the index.
-
#count ⇒ Integer
Get the number of documents in the index.
-
#load ⇒ Boolean
Load the index from persistent storage.
-
#ready? ⇒ Boolean
Check if the index exists and is loaded.
-
#rebuild(documents) ⇒ Boolean
Rebuild the entire index from documents.
-
#remove(id) ⇒ Boolean
Remove a document from the index.
-
#save ⇒ Boolean
Save the index to persistent storage.
-
#search(query, k: 5) ⇒ Array<Hash>
Search for similar documents.
-
#semantic? ⇒ Boolean
Check if this implementation supports semantic search.
Instance Method Details
#add(id, text, metadata: {}) ⇒ Boolean
Add a document to the index
17 18 19 |
# File 'lib/kairos_mcp/vector_search/base.rb', line 17 def add(id, text, metadata: {}) raise NotImplementedError, "#{self.class} must implement #add" end |
#count ⇒ Integer
Get the number of documents in the index
70 71 72 |
# File 'lib/kairos_mcp/vector_search/base.rb', line 70 def count raise NotImplementedError, "#{self.class} must implement #count" end |
#load ⇒ Boolean
Load the index from persistent storage
56 57 58 |
# File 'lib/kairos_mcp/vector_search/base.rb', line 56 def load raise NotImplementedError, "#{self.class} must implement #load" end |
#ready? ⇒ Boolean
Check if the index exists and is loaded
63 64 65 |
# File 'lib/kairos_mcp/vector_search/base.rb', line 63 def ready? raise NotImplementedError, "#{self.class} must implement #ready?" end |
#rebuild(documents) ⇒ Boolean
Rebuild the entire index from documents
42 43 44 |
# File 'lib/kairos_mcp/vector_search/base.rb', line 42 def rebuild(documents) raise NotImplementedError, "#{self.class} must implement #rebuild" end |
#remove(id) ⇒ Boolean
Remove a document from the index
25 26 27 |
# File 'lib/kairos_mcp/vector_search/base.rb', line 25 def remove(id) raise NotImplementedError, "#{self.class} must implement #remove" end |
#save ⇒ Boolean
Save the index to persistent storage
49 50 51 |
# File 'lib/kairos_mcp/vector_search/base.rb', line 49 def save raise NotImplementedError, "#{self.class} must implement #save" end |
#search(query, k: 5) ⇒ Array<Hash>
Search for similar documents
34 35 36 |
# File 'lib/kairos_mcp/vector_search/base.rb', line 34 def search(query, k: 5) raise NotImplementedError, "#{self.class} must implement #search" end |
#semantic? ⇒ Boolean
Check if this implementation supports semantic search
77 78 79 |
# File 'lib/kairos_mcp/vector_search/base.rb', line 77 def semantic? false end |