SyncedEntriesIterator enumerateSyncedEntries(String rootPath, EnumerationMode enumerationMode)

Opens an iterator on a document and/or folder collection matching the rootPath given as parameter. It enumerates entries that have been pushed and are in synced status. It returns a stream of entries. An entry is made of a URI and a stamp.

The underlying idea of this method is to:

  • Enumerate entries in the index.

  • Decode the URI to find items in the data source.

  • Test whether items still exist. If all items have been removed from the datasource, then:

    • delete the document,

    • or decode the stamp and check whether the items have been modified in the datasource.

Iterated results are streamed and used when needed.

This page discusses:

Data types

A SyncedEntriesIterator is an abstract object which can be used to retrieve document statuses.

The object contains:

Types/flag

Description

rootPath

A part of the URI used to select a subset of the corpus.

See also URI.

enumerationMode

The EnumerationMode lists the available types.

For example, NOT_RECURSIVE_ALL returns the subfolders and the documents in the rootPath.

Similarly, RECURSIVE_DOCUMENTS returns all the documents in the rootPath (but not the subfolders).

enum EnumerationMode
{
 NOT_RECURSIVE_FOLDERS,
 NOT_RECURSIVE_DOCUMENTS,
 NOT_RECURSIVE_ALL,
 RECURSIVE_DOCUMENTS
}

HTTP method

The method used is:

GET no-cache http://<host>:<port>/papi/4/connectors/<connectorName>/enumerate_synced_entries

HTTP parameters

The parameters are described in the table below.

Parameter

Location

Description

PAPI_rootPath

[URL]

The rootPath parameter is the string representation of the rootPath. It can take the form:

/root/subdir1/subdir2/subdir3/subdir3/...

PAPI_mode

[URL]

The mode parameter is the string representation of the mode:

  • NOT_RECURSIVE_FOLDERS
  • NOT_RECURSIVE_DOCUMENTS
  • NOT_RECURSIVE_ALL
  • RECURSIVE_DOCUMENTS

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.

HTTP response

The command uses the standard HTTP responses. See HTTP command response.

Here is the response format for each entry:

[D/F] [space] [url_encode(URI)]         [space] [escape(STAMP)] [\n] 

Where

  • url_encode() – is a function which performs an url encoding of the given value.

  • escape() – is a function which replaces \r and \n with \\r and \\n.

  • D/FD indicates an existing document, F indicates a folder.

Use of iterators with concurrent add and delete operations

  • Add/Delete operations do not impact iterators that are already opened.

  • Added/Deleted documents may not appear immediately in the iterated entries because of asynchronous treatment.