X4 Produktdokumentation

Operation: Sync-Documents

The operation Sync-Documents synchronizes one or more documents with the data record.

Input

The adapter expects an XML document with the following structure as input:

<?xml version="1.0" encoding="UTF-8"?>
<x4ai_adapter>
   <doc>
      <pageContent>Document text</pageContent>
      <metadata>         
         <source>Required sourceKey for document</source>
		 <id>Optional</id>
		 <source_url>Optional</source_url>
		 <page>Optional</page>
		 <version>Optional</version>
      </metadata>
   </doc>
   <doc>
      <pageContent>Document text 2</pageContent>
      <metadata>
         <source>Required sourceKey for document</source>
		 <id>Optional</id>
		 <source_url>Optional</source_url>
		 <page>Optional</page>
		 <version>Optional</version>
      </metadata>
   </doc>
   <doc>
      <pageContent>Document text 3</pageContent>
      <metadata>
         <source>Required sourceKey for document</source>
		 <id>Optional</id>
		 <source_url>Optional</source_url>
		 <page>Optional</page>
		 <version>Optional</version>
      </metadata>
   </doc>
   <chunkSize>100</chunkSize>
   <chunkOverlap>10</chunkOverlap>
</x4ai_adapter>

The following elements are included in the input:

Element

Description

x4ai_adapter

Enclosing element for the Sync-Documents operation. Contains the element doc with pageContent and metadata.

doc

Enclosing element for the elements pageContent and metadata.

pageContent

Page contents as text.

metadata

Enclosing element for meta data. Contains the elements source and page. Other meta data can be specified instead of page.

sources

Unique source key (=sourceKey) of the document.

source_url:

(optional)

source_url can be a simple link to a website or the name of the document.

Possible values:

  • URL to a website

  • Document name

page

(optional)

Page number of the document

Possible values:

Integer number

version

(optional)

Document version

Possible values:

Any string

chunkSize

(optional)

Maximum number of characters that a chunk can contain.

Possible values:

Integer number

chunkOverlap

(optional)

Number of characters that should overlap between two neighboring chunks.

Possible values:

Integer number

Output

The adapter generates a XML document as output:

<?xml version="1.0" encoding="UTF-8"?>
<output>
   <response>
      <num_added>9</num_added>
      <num_deleted>0</num_deleted>
      <num_skipped>0</num_skipped>
      <num_updated>0</num_updated>
   </response>
</output>

The following elements can be contained in the output:

Element

Description

Output

Enclosing element for the operation Sync-Documents

response

Enclosing element for the contents of the XML document

num_added

Number of data sets added to a document.

num_deleted

Number of deleted data sets of a document. Irrelevant for the operation Remove-Documents.

num_skipped

Number of skipped data sets of a document.

num_updated

Number of updated data sets of a document.