Class: SwarmMemory::Search::TextSearch
- Inherits:
-
Object
- Object
- SwarmMemory::Search::TextSearch
- Defined in:
- lib/swarm_memory/search/text_search.rb
Overview
Text-based search operations (glob and grep)
Provides a clean API for text-based search that wraps adapter operations. This layer could add additional logic like query parsing, ranking, etc.
Instance Method Summary collapse
-
#glob(pattern:) ⇒ Array<Hash>
Search by glob pattern.
-
#grep(pattern:, case_insensitive: false, output_mode: "files_with_matches", path: nil) ⇒ Array<Hash>
Search by content pattern.
-
#initialize(adapter:) ⇒ TextSearch
constructor
Initialize text search.
Constructor Details
#initialize(adapter:) ⇒ TextSearch
Initialize text search
13 14 15 |
# File 'lib/swarm_memory/search/text_search.rb', line 13 def initialize(adapter:) @adapter = adapter end |
Instance Method Details
#glob(pattern:) ⇒ Array<Hash>
Search by glob pattern
21 22 23 |
# File 'lib/swarm_memory/search/text_search.rb', line 21 def glob(pattern:) @adapter.glob(pattern: pattern) end |
#grep(pattern:, case_insensitive: false, output_mode: "files_with_matches", path: nil) ⇒ Array<Hash>
Search by content pattern
32 33 34 35 36 37 38 39 |
# File 'lib/swarm_memory/search/text_search.rb', line 32 def grep(pattern:, case_insensitive: false, output_mode: "files_with_matches", path: nil) @adapter.grep( pattern: pattern, case_insensitive: case_insensitive, output_mode: output_mode, path: path, ) end |