Class: DocumentConversionV1

DocumentConversionV1

new DocumentConversionV1(options)

Document Conversion service

Parameters:
Name Type Description
options Object
Source:

Methods

convert(params, callback)

One-off convert an attached document OR convert a previously uploaded document by ID

To convert a previously uploaded document, set params.document_id

Parameters:
Name Type Description
params Object
Properties
Name Type Attributes Description
conversion_target Object

Must be set to one of ['answer_units', 'normalized_html', 'normalized_text']

file ReadableStream <optional>

The document file to convert. May be a ReadableStream or Buffer

content_type String <optional>

Set this when the content type cannot be determined from the filename (params.file.path)

config Object <optional>

Optional configuration option. Recommended way to set configuration.

callback function
Source:

index(params, callback)

One-off convert and index a document via index_document API

NOTE: A SOLR cluster and search collection will have to be created through the Retrieve and Rank service prior to using this API if actual indexing is performed (dry_run=false).

Parameters:
Name Type Description
params Object
Properties
Name Type Attributes Description
file ReadableStream <optional>

The document file to convert. May be a ReadableStream or Buffer

metadata Object

Metadata array of Object's where each object contains 'name' and 'value'

config Object

Configuration for the conversion and indexing. The conversion config needs to be in a 'convert_document' object. This can include configuration for 'pdf', 'word' and 'normalized_html' phases of the conversion process. The indexing config needs to be in a 'retrieve_and_rank' object. The 'retrieve_and_rank' object has the following fields: 'dry_run' - boolean value, true if a dry run is to be performed, false to actually index, 'service_instance_id' - The serviceGuid of your instance of the retrieve and rank service (required if dry_run=false), 'cluster_id' - The Solr cluster id for your retrieve and rank service instance (required if dry_run=false), 'search_collection' - The name of your Solr search collection from your retrieve and rank service instance (required if dry_run=false), and 'fields' - Configuration information for field 'mappings', fields to 'include', and fields to 'exclude' during indexing (exclude takes precedence over include)

callback function
Source: