Class: Couchbase::Management::ScopeSearchIndexManager
- Inherits:
-
Object
- Object
- Couchbase::Management::ScopeSearchIndexManager
- Defined in:
- lib/couchbase/management/scope_search_index_manager.rb
Constant Summary collapse
- GetIndexOptions =
SearchIndexManager::GetIndexOptions
- GetAllIndexesOptions =
SearchIndexManager::GetAllIndexesOptions
- UpsertIndexOptions =
SearchIndexManager::UpsertIndexOptions
- DropIndexOptions =
SearchIndexManager::DropIndexOptions
- GetIndexedDocumentsCountOptions =
SearchIndexManager::GetIndexedDocumentsCountOptions
- PauseIngestOptions =
SearchIndexManager::PauseIngestOptions
- ResumeIngestOptions =
SearchIndexManager::ResumeIngestOptions
- AllowQueryingOptions =
SearchIndexManager::AllowQueryingOptions
- DisallowQueryingOptions =
SearchIndexManager::DisallowQueryingOptions
- FreezePlanOptions =
SearchIndexManager::FreezePlanOptions
- UnfreezePlanOptions =
SearchIndexManager::UnfreezePlanOptions
- AnalyzeDocumentOptions =
SearchIndexManager::AnalyzeDocumentOptions
Instance Method Summary collapse
-
#allow_querying(index_name, options = AllowQueryingOptions.new) ⇒ Object
Allows querying against the index.
-
#analyze_document(index_name, document, options = AnalyzeDocumentOptions.new) ⇒ Array<Hash>
Allows to see how a document is analyzed against a specific index.
-
#disallow_querying(index_name, options = DisallowQueryingOptions.new) ⇒ Object
Disallows querying against the index.
-
#drop_index(index_name, options = DropIndexOptions.new) ⇒ Object
Drops the index.
-
#freeze_plan(index_name, options = FreezePlanOptions.new) ⇒ Object
Freeze the assignment of index partitions to nodes.
-
#get_all_indexes(options = GetAllIndexesOptions.new) ⇒ Array<SearchIndex>
Fetches all indexes from the server.
-
#get_index(index_name, options = GetIndexOptions.new) ⇒ SearchIndex
Fetches an index from the server if it exists.
-
#get_indexed_documents_count(index_name, options = GetIndexedDocumentsCountOptions.new) ⇒ Integer
Retrieves the number of documents that have been indexed for an index.
-
#initialize(backend, bucket_name, scope_name) ⇒ ScopeSearchIndexManager
constructor
A new instance of ScopeSearchIndexManager.
-
#pause_ingest(index_name, options = PauseIngestOptions.new) ⇒ Object
Pauses updates and maintenance for the index.
-
#resume_ingest(index_name, options = ResumeIngestOptions.new) ⇒ Object
Resumes updates and maintenance for an index.
-
#unfreeze_plan(index_name, options = UnfreezePlanOptions.new) ⇒ Object
Unfreeze the assignment of index partitions to nodes.
-
#upsert_index(index_definition, options = UpsertIndexOptions.new) ⇒ Object
Creates or updates the index.
Constructor Details
#initialize(backend, bucket_name, scope_name) ⇒ ScopeSearchIndexManager
Returns a new instance of ScopeSearchIndexManager.
25 26 27 28 29 |
# File 'lib/couchbase/management/scope_search_index_manager.rb', line 25 def initialize(backend, bucket_name, scope_name) @backend = backend @bucket_name = bucket_name @scope_name = scope_name end |
Instance Method Details
#allow_querying(index_name, options = AllowQueryingOptions.new) ⇒ Object
Allows querying against the index
129 130 131 |
# File 'lib/couchbase/management/scope_search_index_manager.rb', line 129 def (index_name, = AllowQueryingOptions.new) @backend.(@bucket_name, @scope_name, index_name, .timeout) end |
#analyze_document(index_name, document, options = AnalyzeDocumentOptions.new) ⇒ Array<Hash>
Allows to see how a document is analyzed against a specific index
181 182 183 184 |
# File 'lib/couchbase/management/scope_search_index_manager.rb', line 181 def analyze_document(index_name, document, = AnalyzeDocumentOptions.new) res = @backend.search_index_analyze_document(@bucket_name, @scope_name, index_name, JSON.generate(document), .timeout) JSON.parse(res[:analysis]) end |
#disallow_querying(index_name, options = DisallowQueryingOptions.new) ⇒ Object
Disallows querying against the index
142 143 144 |
# File 'lib/couchbase/management/scope_search_index_manager.rb', line 142 def (index_name, = DisallowQueryingOptions.new) @backend.(@bucket_name, @scope_name, index_name, .timeout) end |
#drop_index(index_name, options = DropIndexOptions.new) ⇒ Object
Drops the index
76 77 78 |
# File 'lib/couchbase/management/scope_search_index_manager.rb', line 76 def drop_index(index_name, = DropIndexOptions.new) @backend.search_index_drop(@bucket_name, @scope_name, index_name, .timeout) end |
#freeze_plan(index_name, options = FreezePlanOptions.new) ⇒ Object
Freeze the assignment of index partitions to nodes
155 156 157 |
# File 'lib/couchbase/management/scope_search_index_manager.rb', line 155 def freeze_plan(index_name, = FreezePlanOptions.new) @backend.search_index_freeze_plan(@bucket_name, @scope_name, index_name, .timeout) end |
#get_all_indexes(options = GetAllIndexesOptions.new) ⇒ Array<SearchIndex>
Fetches all indexes from the server
50 51 52 53 |
# File 'lib/couchbase/management/scope_search_index_manager.rb', line 50 def get_all_indexes( = GetAllIndexesOptions.new) res = @backend.search_index_get_all(@bucket_name, @scope_name, .timeout) res[:indexes].map { |idx| SearchIndexManager.extract_search_index(idx) } end |
#get_index(index_name, options = GetIndexOptions.new) ⇒ SearchIndex
Fetches an index from the server if it exists
40 41 42 43 |
# File 'lib/couchbase/management/scope_search_index_manager.rb', line 40 def get_index(index_name, = GetIndexOptions.new) res = @backend.search_index_get(@bucket_name, @scope_name, index_name, .timeout) SearchIndexManager.extract_search_index(res) end |
#get_indexed_documents_count(index_name, options = GetIndexedDocumentsCountOptions.new) ⇒ Integer
Retrieves the number of documents that have been indexed for an index
89 90 91 92 |
# File 'lib/couchbase/management/scope_search_index_manager.rb', line 89 def get_indexed_documents_count(index_name, = GetIndexedDocumentsCountOptions.new) res = @backend.search_index_get_documents_count(@bucket_name, @scope_name, index_name, .timeout) res[:count] end |
#pause_ingest(index_name, options = PauseIngestOptions.new) ⇒ Object
Pauses updates and maintenance for the index
103 104 105 |
# File 'lib/couchbase/management/scope_search_index_manager.rb', line 103 def pause_ingest(index_name, = PauseIngestOptions.new) @backend.search_index_pause_ingest(@bucket_name, @scope_name, index_name, .timeout) end |
#resume_ingest(index_name, options = ResumeIngestOptions.new) ⇒ Object
Resumes updates and maintenance for an index
116 117 118 |
# File 'lib/couchbase/management/scope_search_index_manager.rb', line 116 def resume_ingest(index_name, = ResumeIngestOptions.new) @backend.search_index_resume_ingest(@bucket_name, @scope_name, index_name, .timeout) end |
#unfreeze_plan(index_name, options = UnfreezePlanOptions.new) ⇒ Object
Unfreeze the assignment of index partitions to nodes
168 169 170 |
# File 'lib/couchbase/management/scope_search_index_manager.rb', line 168 def unfreeze_plan(index_name, = UnfreezePlanOptions.new) @backend.search_index_unfreeze_plan(@bucket_name, @scope_name, index_name, .timeout) end |
#upsert_index(index_definition, options = UpsertIndexOptions.new) ⇒ Object
Creates or updates the index
63 64 65 |
# File 'lib/couchbase/management/scope_search_index_manager.rb', line 63 def upsert_index(index_definition, = UpsertIndexOptions.new) @backend.search_index_upsert(@bucket_name, @scope_name, index_definition.to_backend, .timeout) end |