Class: Couchbase::Management::ScopeSearchIndexManager
- Inherits:
-
Object
- Object
- Couchbase::Management::ScopeSearchIndexManager
- Defined in:
- lib/couchbase/management/scope_search_index_manager.rb,
/home/runner/work/couchbase-ruby-client/couchbase-ruby-client/lib/couchbase/management/scope_search_index_manager.rb
Instance Method Summary collapse
-
#allow_querying(index_name, options = Options::Search::AllowQuerying::DEFAULT) ⇒ Object
Allows querying against the index.
-
#analyze_document(index_name, document, options = Options::Search::AnalyzeDocument::DEFAULT) ⇒ Array<Hash>
Allows to see how a document is analyzed against a specific index.
-
#disallow_querying(index_name, options = Options::Search::DisallowQuerying::DEFAULT) ⇒ Object
Disallows querying against the index.
-
#drop_index(index_name, options = Options::Search::DropIndex::DEFAULT) ⇒ Object
Drops the index.
-
#freeze_plan(index_name, options = Options::Search::FreezePlan::DEFAULT) ⇒ Object
Freeze the assignment of index partitions to nodes.
-
#get_all_indexes(options = Options::Search::GetAllIndexes::DEFAULT) ⇒ Array<SearchIndex>
Fetches all indexes from the server.
-
#get_index(index_name, options = Options::Search::GetIndex::DEFAULT) ⇒ SearchIndex
Fetches an index from the server if it exists.
-
#get_indexed_documents_count(index_name, options = Options::Search::GetIndexedDocumentsCount::DEFAULT) ⇒ Integer
Retrieves the number of documents that have been indexed for an index.
-
#initialize(backend, bucket_name, scope_name, observability) ⇒ ScopeSearchIndexManager
constructor
A new instance of ScopeSearchIndexManager.
-
#pause_ingest(index_name, options = Options::Search::PauseIngest::DEFAULT) ⇒ Object
Pauses updates and maintenance for the index.
-
#resume_ingest(index_name, options = Options::Search::ResumeIngest::DEFAULT) ⇒ Object
Resumes updates and maintenance for an index.
-
#unfreeze_plan(index_name, options = Options::Search::UnfreezePlan::DEFAULT) ⇒ Object
Unfreeze the assignment of index partitions to nodes.
-
#upsert_index(index_definition, options = Options::Search::UpsertIndex::DEFAULT) ⇒ Object
Creates or updates the index.
Constructor Details
#initialize(backend, bucket_name, scope_name, observability) ⇒ ScopeSearchIndexManager
Returns a new instance of ScopeSearchIndexManager.
28 29 30 31 32 33 |
# File 'lib/couchbase/management/scope_search_index_manager.rb', line 28 def initialize(backend, bucket_name, scope_name, observability) @backend = backend @bucket_name = bucket_name @scope_name = scope_name @observability = observability end |
Instance Method Details
#allow_querying(index_name, options = Options::Search::AllowQuerying::DEFAULT) ⇒ Object
Allows querying against the index
148 149 150 151 152 |
# File 'lib/couchbase/management/scope_search_index_manager.rb', line 148 def (index_name, = Options::Search::AllowQuerying::DEFAULT) @observability.record_operation(Observability::OP_SM_ALLOW_QUERYING, .parent_span, self, :search) do |obs_handler| @backend.(@bucket_name, @scope_name, index_name, .timeout, obs_handler) end end |
#analyze_document(index_name, document, options = Options::Search::AnalyzeDocument::DEFAULT) ⇒ Array<Hash>
Allows to see how a document is analyzed against a specific index
209 210 211 212 213 214 215 216 |
# File 'lib/couchbase/management/scope_search_index_manager.rb', line 209 def analyze_document(index_name, document, = Options::Search::AnalyzeDocument::DEFAULT) @observability.record_operation(Observability::OP_SM_ANALYZE_DOCUMENT, .parent_span, self, :search) do |obs_handler| res = @backend.search_index_analyze_document( @bucket_name, @scope_name, index_name, JSON.generate(document), .timeout, obs_handler ) JSON.parse(res[:analysis]) end end |
#disallow_querying(index_name, options = Options::Search::DisallowQuerying::DEFAULT) ⇒ Object
Disallows querying against the index
163 164 165 166 167 |
# File 'lib/couchbase/management/scope_search_index_manager.rb', line 163 def (index_name, = Options::Search::DisallowQuerying::DEFAULT) @observability.record_operation(Observability::OP_SM_DISALLOW_QUERYING, .parent_span, self, :search) do |obs_handler| @backend.(@bucket_name, @scope_name, index_name, .timeout, obs_handler) end end |
#drop_index(index_name, options = Options::Search::DropIndex::DEFAULT) ⇒ Object
Drops the index
86 87 88 89 90 |
# File 'lib/couchbase/management/scope_search_index_manager.rb', line 86 def drop_index(index_name, = Options::Search::DropIndex::DEFAULT) @observability.record_operation(Observability::OP_SM_DROP_INDEX, .parent_span, self, :search) do |obs_handler| @backend.search_index_drop(@bucket_name, @scope_name, index_name, .timeout, obs_handler) end end |
#freeze_plan(index_name, options = Options::Search::FreezePlan::DEFAULT) ⇒ Object
Freeze the assignment of index partitions to nodes
178 179 180 181 182 |
# File 'lib/couchbase/management/scope_search_index_manager.rb', line 178 def freeze_plan(index_name, = Options::Search::FreezePlan::DEFAULT) @observability.record_operation(Observability::OP_SM_FREEZE_PLAN, .parent_span, self, :search) do |obs_handler| @backend.search_index_freeze_plan(@bucket_name, @scope_name, index_name, .timeout, obs_handler) end end |
#get_all_indexes(options = Options::Search::GetAllIndexes::DEFAULT) ⇒ Array<SearchIndex>
Fetches all indexes from the server
56 57 58 59 60 61 |
# File 'lib/couchbase/management/scope_search_index_manager.rb', line 56 def get_all_indexes( = Options::Search::GetAllIndexes::DEFAULT) @observability.record_operation(Observability::OP_SM_GET_ALL_INDEXES, .parent_span, self, :search) do |obs_handler| res = @backend.search_index_get_all(@bucket_name, @scope_name, .timeout, obs_handler) res[:indexes].map { |idx| SearchIndexManager.extract_search_index(idx) } end end |
#get_index(index_name, options = Options::Search::GetIndex::DEFAULT) ⇒ SearchIndex
Fetches an index from the server if it exists
44 45 46 47 48 49 |
# File 'lib/couchbase/management/scope_search_index_manager.rb', line 44 def get_index(index_name, = Options::Search::GetIndex::DEFAULT) @observability.record_operation(Observability::OP_SM_GET_INDEX, .parent_span, self, :search) do |obs_handler| res = @backend.search_index_get(@bucket_name, @scope_name, index_name, .timeout, obs_handler) SearchIndexManager.extract_search_index(res) end end |
#get_indexed_documents_count(index_name, options = Options::Search::GetIndexedDocumentsCount::DEFAULT) ⇒ Integer
Retrieves the number of documents that have been indexed for an index
101 102 103 104 105 106 107 |
# File 'lib/couchbase/management/scope_search_index_manager.rb', line 101 def get_indexed_documents_count(index_name, = Options::Search::GetIndexedDocumentsCount::DEFAULT) @observability.record_operation(Observability::OP_SM_GET_INDEXED_DOCUMENTS_COUNT, .parent_span, self, :search) do |obs_handler| res = @backend.search_index_get_documents_count(@bucket_name, @scope_name, index_name, .timeout, obs_handler) res[:count] end end |
#pause_ingest(index_name, options = Options::Search::PauseIngest::DEFAULT) ⇒ Object
Pauses updates and maintenance for the index
118 119 120 121 122 |
# File 'lib/couchbase/management/scope_search_index_manager.rb', line 118 def pause_ingest(index_name, = Options::Search::PauseIngest::DEFAULT) @observability.record_operation(Observability::OP_SM_PAUSE_INGEST, .parent_span, self, :search) do |obs_handler| @backend.search_index_pause_ingest(@bucket_name, @scope_name, index_name, .timeout, obs_handler) end end |
#resume_ingest(index_name, options = Options::Search::ResumeIngest::DEFAULT) ⇒ Object
Resumes updates and maintenance for an index
133 134 135 136 137 |
# File 'lib/couchbase/management/scope_search_index_manager.rb', line 133 def resume_ingest(index_name, = Options::Search::ResumeIngest::DEFAULT) @observability.record_operation(Observability::OP_SM_RESUME_INGEST, .parent_span, self, :search) do |obs_handler| @backend.search_index_resume_ingest(@bucket_name, @scope_name, index_name, .timeout, obs_handler) end end |
#unfreeze_plan(index_name, options = Options::Search::UnfreezePlan::DEFAULT) ⇒ Object
Unfreeze the assignment of index partitions to nodes
193 194 195 196 197 |
# File 'lib/couchbase/management/scope_search_index_manager.rb', line 193 def unfreeze_plan(index_name, = Options::Search::UnfreezePlan::DEFAULT) @observability.record_operation(Observability::OP_SM_UNFREEZE_PLAN, .parent_span, self, :search) do |obs_handler| @backend.search_index_unfreeze_plan(@bucket_name, @scope_name, index_name, .timeout, obs_handler) end end |
#upsert_index(index_definition, options = Options::Search::UpsertIndex::DEFAULT) ⇒ Object
Creates or updates the index
71 72 73 74 75 |
# File 'lib/couchbase/management/scope_search_index_manager.rb', line 71 def upsert_index(index_definition, = Options::Search::UpsertIndex::DEFAULT) @observability.record_operation(Observability::OP_SM_UPSERT_INDEX, .parent_span, self, :search) do |obs_handler| @backend.search_index_upsert(@bucket_name, @scope_name, index_definition.to_backend, .timeout, obs_handler) end end |