CloudSearchService

public class CloudSearchService extends Object

Service wrapper for Cloud Search API client. Example usage:

   CloudSearchService service = new CloudSearchService(serviceAccountKeyPath, sourceId);
   Item item = service.getItem(itemName);
 

Public Constructor Summary

CloudSearchService(String serviceAccountKeyPath, String sourceId, Optional<String> rootUrl)

Public Method Summary

void
deleteAllItems()
Deletes all items available in the datasource.
Operation
deleteItem(String itemName, String version)
void
deleteItemsIfExist(List<String> itemIds)
void
deleteItemsIfExist(String... itemIds)
Deletes items if they exist in the indexing API.
Item
getItem(String itemName)
Gets an item from indexing service using item name.
Schema
List<Item>
listItems()
Gets all items available in data source.
static void
main(String[] args)
The purpose of the main method is to explicitly call utility method deleteAllItems().

Inherited Method Summary

Public Constructors

public CloudSearchService (String serviceAccountKeyPath, String sourceId, Optional<String> rootUrl)

Parameters
serviceAccountKeyPath
sourceId
rootUrl
Throws
IOException
GeneralSecurityException

Public Methods

public void deleteAllItems ()

Deletes all items available in the datasource.

Throws
IOException

public Operation deleteItem (String itemName, String version)

Parameters
itemName
version
Throws
IOException

public void deleteItemsIfExist (List<String> itemIds)

Parameters
itemIds

public void deleteItemsIfExist (String... itemIds)

Deletes items if they exist in the indexing API. This method attempts to delete the remaining items in the list even if deletion of one fails.

Parameters
itemIds - the IDs of the items to delete.

public Item getItem (String itemName)

Gets an item from indexing service using item name.

Parameters
itemName
Throws
IOException

public Schema getSchema ()

Throws
IOException

public List<Item> listItems ()

Gets all items available in data source.

Throws
IOException

public static void main (String[] args)

The purpose of the main method is to explicitly call utility method deleteAllItems(). Deletes all items from the datasource if they exist in the indexing API. Can be used as periodic cleanup of items in the datasource.

Parameters
args
Throws
IOException
GeneralSecurityException