IndexingServiceImpl

public class IndexingServiceImpl extends BaseApiService<CloudSearch>
implements IndexingService

Wrapper object for CloudSearch.Indexing.

This is the access point between the connector developer and the indexing service. All calls for updating and retrieving CloudSearch.Indexing.Datasources.Items objects are processed through this object.

Configuration parameters:

  • .ROOT_URL - Specifies the indexing service base URL path.
  • .SOURCE_ID - Specifies the data source ID (created via the admin console) indicating the location for the ingested repository documents.
  • .IDENTITY_SOURCE_ID - Specifies the identity source ID (created via the admin console) to use for users and groups that are attached to ACL definitions.
  • .CONNECTOR_ID - Specifies the connector identifier for making Indexing API
  • .UPLOAD_THRESHOLD_BYTES - Specifies the threshold for content, in number of bytes, that determines whether it is uploaded "in-line" with the other document info or using a separate upload.
  • .INDEXING_SERVICE_REQUEST_MODE - Specifies the default request mode for index and delete item requests

Nested Class Summary

class IndexingServiceImpl.Builder  
enum IndexingServiceImpl.Operations API Operations  
enum IndexingServiceImpl.PollItemStatus Valid values for poll Item status. 
class IndexingServiceImpl.ServiceManagerHelper  

Constant Summary

String CONNECTOR_ID
int DEFAULT_CONTENT_UPLOAD_THRESHOLD_BYTES
String IDENTITY_SOURCE_ID
String INDEXING_SERVICE_REQUEST_MODE
String REQUEST_CONNECT_TIMEOUT
String REQUEST_READ_TIMEOUT
String ROOT_URL
String SOURCE_ID
String UPLOAD_THRESHOLD_BYTES

Field Summary

public static final Set<String> API_SCOPES

Inherited Field Summary

Public Method Summary

ListenableFuture<Operation>
deleteItem(String id, byte[] version, IndexingService.RequestMode requestMode)
Deletes an Item.
ListenableFuture<Operation>
deleteQueueItems(String queueName)
Deletes items from a queue.
Item
getItem(String id)
Gets an Item.
Operation
getOperation(String name)
Returns the Operation with the given name.
Schema
getSchema()
Gets the Schema defined within the connected data source.
ListenableFuture<Operation>
indexItem(Item item, IndexingService.RequestMode requestMode)
Updates an Item.
ListenableFuture<Operation>
indexItemAndContent(Item item, AbstractInputStreamContent content, String contentHash, IndexingService.ContentFormat contentFormat, IndexingService.RequestMode requestMode)
Updates an Item.
Iterable<Item>
listItem(boolean brief)
Fetches the first of what may be many sets of Item.
List<Item>
poll(PollItemsRequest pollQueueRequest)
Polls the queue using custom API parameters.
Iterable<Item>
pollAll(PollItemsRequest pollQueueRequest)
Polls the queue repeatedly until the entire queue is polled.
ListenableFuture<Item>
push(String id, PushItem pushItem)
Pushes a PushItem object to the indexing API Queue.
UploadItemRef
startUpload(String itemId)
Creates UploadItemRef for uploading media content.
ListenableFuture<Operation>
unreserve(String queue)
Unreserves the polled Item objects in a specific queue.

Protected Method Summary

void
void

Inherited Method Summary

Constants

public static final String CONNECTOR_ID

Constant Value: "api.connectorId"

public static final int DEFAULT_CONTENT_UPLOAD_THRESHOLD_BYTES

Constant Value: 100000

public static final String IDENTITY_SOURCE_ID

Constant Value: "api.identitySourceId"

public static final String INDEXING_SERVICE_REQUEST_MODE

Constant Value: "api.defaultRequestMode"

public static final String REQUEST_CONNECT_TIMEOUT

Constant Value: "indexingService.connectTimeoutSeconds"

public static final String REQUEST_READ_TIMEOUT

Constant Value: "indexingService.readTimeoutSeconds"

public static final String ROOT_URL

Constant Value: "api.rootUrl"

public static final String SOURCE_ID

Constant Value: "api.sourceId"

public static final String UPLOAD_THRESHOLD_BYTES

Constant Value: "api.contentUploadThresholdBytes"

Fields

public static final Set<String> API_SCOPES

Public Methods

public ListenableFuture<Operation> deleteItem (String id, byte[] version, IndexingService.RequestMode requestMode)

Deletes an Item.

Cloud Search won't delete an item if the passed version value is less than the currently indexed item's version.

Parameters
id the item id.
version the item's version used to compare against the previously indexed item's version
requestMode mode for delete request
Returns
Throws
IOException when service throws an exception.

public ListenableFuture<Operation> deleteQueueItems (String queueName)

Deletes items from a queue.

Parameters
queueName the queue name
Returns
  • ListenableFuture that the caller uses to obtain the result of a delete queue items operation (using get()).
Throws
IOException when the service throws an exception

public Item getItem (String id)

Gets an Item.

Parameters
id the item ID
Returns
  • the item or null if not found
Throws
IOException when the service throws an exception

public Operation getOperation (String name)

Returns the Operation with the given name.

Parameters
name the operation name
Returns
  • the Operation object describing the current state of the long-running operation
Throws
IOException

public Schema getSchema ()

Gets the Schema defined within the connected data source.

Each data source may have at most one schema defined within it. This method extracts the schema definition to use with the current connector's data repository.

Returns
  • Schema defined within the connected data source
Throws
IOException

public ListenableFuture<Operation> indexItem (Item item, IndexingService.RequestMode requestMode)

Updates an Item.

Parameters
item the item to update
requestMode the IndexingService.RequestMode for the request
Returns
Throws
IOException when the service throws an exception

public ListenableFuture<Operation> indexItemAndContent (Item item, AbstractInputStreamContent content, String contentHash, IndexingService.ContentFormat contentFormat, IndexingService.RequestMode requestMode)

Updates an Item. The content parameter should use a concrete implementation of AbstractInputStreamContent based on the natural source object:

  • For InputStream, use InputStreamContent. For best results, if the length of the content (in bytes) is known without reading the stream, call setLength on the InputStreamContent.
  • For String or byte[], use ByteArrayContent.
  • For existing files, use FileContent.

Parameters
item the item to update
content the item's content
contentHash the hash of the item's content
contentFormat format of the content
requestMode the IndexingService.RequestMode for the request
Returns
Throws
IOException when the service throws an exception

public Iterable<Item> listItem (boolean brief)

Fetches the first of what may be many sets of Item.

Parameters
brief true to shorten Item metadata, default: true
Returns
  • an iterator for the returned set of Item
Throws
IOException when the service throws an exception

public List<Item> poll (PollItemsRequest pollQueueRequest)

Polls the queue using custom API parameters.

Parameters
pollQueueRequest the user created and populated poll request
Returns
  • entries returned from the queue
Throws
IOException when the service throws an exception

public Iterable<Item> pollAll (PollItemsRequest pollQueueRequest)

Polls the queue repeatedly until the entire queue is polled.

Parameters
pollQueueRequest the user created and populated poll request
Returns
  • an iterator for entries returned from the queue
Throws
IOException when the service throws an exception

public ListenableFuture<Item> push (String id, PushItem pushItem)

Pushes a PushItem object to the indexing API Queue.

Parameters
id the item id
pushItem the item to push
Returns
Throws
IOException when the service throws an exception

public UploadItemRef startUpload (String itemId)

Creates UploadItemRef for uploading media content.

Parameters
itemId for which upload reference to be created.
Returns
Throws
IOException

public ListenableFuture<Operation> unreserve (String queue)

Unreserves the polled Item objects in a specific queue.

Parameters
queue the queue to unreserve (null for the default queue)
Returns
Throws
IOException when the service throws an exception

Protected Methods

protected void shutDown ()

Throws
Exception

protected void startUp ()

Throws
Exception

Send feedback about...

Cloud Search
Cloud Search