Module: SwiftypeEnterprise::Client::ContentSourceDocuments
- Included in:
- SwiftypeEnterprise::Client
- Defined in:
- lib/swiftype-enterprise/client.rb
Overview
Documents have fields that can be searched or filtered.
For more information on indexing documents, see the Content Source documentation.
Constant Summary collapse
- REQUIRED_TOP_LEVEL_KEYS =
[ 'external_id', 'url', 'title', 'body' ].map!(&:freeze).to_set.freeze
- OPTIONAL_TOP_LEVEL_KEYS =
[ 'created_at', 'updated_at', 'type', ].map!(&:freeze).to_set.freeze
- CORE_TOP_LEVEL_KEYS =
(REQUIRED_TOP_LEVEL_KEYS + OPTIONAL_TOP_LEVEL_KEYS).freeze
Instance Method Summary collapse
-
#destroy_documents(content_source_key, document_ids) ⇒ Array<Hash>
Destroy a batch of documents given a list of external IDs.
-
#index_documents(content_source_key, documents) ⇒ Array<Hash>
Index a batch of documents using the Content Source API.
Instance Method Details
#destroy_documents(content_source_key, document_ids) ⇒ Array<Hash>
Destroy a batch of documents given a list of external IDs
79 80 81 82 |
# File 'lib/swiftype-enterprise/client.rb', line 79 def destroy_documents(content_source_key, document_ids) document_ids = Array(document_ids) post("ent/sources/#{content_source_key}/documents/bulk_destroy.json", document_ids) end |
#index_documents(content_source_key, documents) ⇒ Array<Hash>
Index a batch of documents using the Content Source API.
66 67 68 69 70 |
# File 'lib/swiftype-enterprise/client.rb', line 66 def index_documents(content_source_key, documents) documents = Array(documents).map! { |document| validate_and_normalize_document(document) } async_create_or_update_documents(content_source_key, documents) end |