void addDocument(Document document) and void addDocumentList(Document[ ] documentList)

This method requests to add a document. If a document with the same URI has already been added, the document will be updated.

Note: If the conversion of a Part fails, this Part is not indexed but the other Part and the Metas are included.

This page discusses:

Document data types

When you implement the addDocument method you must send one or more documents to be added to the index. The Document object should contain:

Types

Description

uri

A URI, which is an opaque string that uniquely identifies the document from the connector point of view.

See also URI.

stamp

An optional Stamp, which is an opaque string that the connector may use to track document changes. Document stamps may be retrieved through the getDocumentStatus method.

See also Stamps.

MetaContainer

The MetaContainer of the document. Metadata are open name-value pairs.

For a complete list of metadata understood by the API, see Metadata Examples.

PartContainer

The PartContainer of the document. The Connector sends raw bytes containing the document content. Exalead CloudView conversion services will translate and extract the textual content of the document before indexing.

The Part contains a DirectiveContainer.

DirectiveContainer

The DirectiveContainer of the document (different from the directive associated to a Part).

Implement the part object

The Part object must provide accessors for the following predefined directives:

  • encoding

  • filename

  • mimeHint

  • certifiedMime

To set a custom directive, the Part object must also provide a method, for example:

public void setCustomDirective(string name, string value)
public void setCustomDirective(Directive directive)
public void setCustomDirective(string name, string[] values)
public void addCustomDirective(string name, string value)

Implement the document object

The Document object must provide accessors for these predefined directives:

  • forcedSlice

  • sameSlice

And a method to set a custom directive:

public void setCustomDirective(string name, string value)
public void setCustomDirective(Directive directive)
public void setCustomDirective(string name, string[] values)
public void addCustomDirective(string name, string value)

HTTP parameters

The add_documents parameters are described in the table below.

Important: This method sends HTTP POST requests.
Note: These parameters must be repeated (with a different id) for every document you want to send.

For better performance, we recommend using a multipart/form-data instead of application/x-www-form-urlencoded.

Parameter

Location

Description

PAPI_<id>:uri

[URL/

FORM]

The uri parameter is the string of the document URI.

PAPI_<id>:stamp

[URL/

FORM]

The optional stamp parameter is the string representing the document's Stamp.

PAPI_<id>:meta:<meta_name>

[URL/

FORM]

The meta_* parameter is a string containing the value of the metadata referenced by metaname.

Multiple values may exist for the same parameter. You must generate as many parameters as there are values.

PAPI_<id>:directive:

<directive_name>

[URL/

FORM]

The list of optional supported directives (at the document level):

  • forcedSlice: advanced feature

PAPI_<id>:part_bytes:<part_name>

[URL/

FORM]

The part_bytes parameter is the content of the document's part that is identified by part_name.

PAPI_<id>:part_directive:

<part_name>:<directive_name>

[URL/

FORM]

The list of optional supported directives (at the part level):

  • filename: the document filename
  • mimeHint: the hint mime parameter
  • mime: the forced mime (use very carefully)
  • encoding: the document encoding

PAPI_session

[URL]

The optional parameter that retrieves the session given by a previous call to get_current_session_id

Action: if there is a session mismatch, the Push API server refuses the command and returns an exception.