IndexingConnector
Stay organized with collections
Save and categorize content based on your preferences.
Known Indirect Subclasses
FullTraversalConnector |
Template connector that performs a full repository traversal and uploads every document. |
ListingConnector |
Template connector that performs complete repository list traversals. |
|
Interface for user-specific implementation details of the connector.
Implementations must be thread-safe. Implementations are discouraged from keeping any state
locally except perhaps soft-state such as a connection cache.
Public Method Summary
abstract
void
|
|
abstract
void
|
traverse()
Implements a connector-specific traversal strategy.
|
Inherited Method Summary
From interface
com.google.enterprise.cloudsearch.sdk.Connector
abstract
void
|
destroy()
Shuts down and releases connector resources.
|
String
|
|
abstract
void
|
init(T context)
Initializes the connector with the current context.
|
abstract
void
|
saveCheckpoint(boolean isShutdown)
Saves checkpoint information such as current traversal position or incremental change tokens.
|
abstract
void
|
traverse()
Implements a connector-specific traversal strategy.
|
Public Methods
Initializes the connector with the current context.
Initialization is the ideal time to start any threads to do extra behind-the-scenes work.
The context
allows access to other useful objects that can be used at any time such as
the IndexingService
.
If an unrecoverable fatal error occurs during initialization, throw a StartupException
to cancel the startup process. If a recoverable error occurs during
initialization, most Exception
instances other than StartupException
cause a
retry of initialization after a short delay.
Throws
Exception |
if errors occur during connector initialization
|
public
abstract
void
traverse
()
Throws
IOException |
if getting data access errors |
InterruptedException |
if an IO operations throws it
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-03-18 UTC.
[null,null,["Last updated 2025-03-18 UTC."],[],[],null,["# IndexingConnector\n\npublic interface **IndexingConnector** implements [Connector](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/Connector)\\\u003c[IndexingConnectorContext](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/indexing/IndexingConnectorContext)\\\u003e \n\n|---|---|---|\n| Known Indirect Subclasses [FullTraversalConnector](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/indexing/template/FullTraversalConnector), [ListingConnector](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/indexing/template/ListingConnector) |-----------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------| | [FullTraversalConnector](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/indexing/template/FullTraversalConnector) | Template connector that performs a full repository traversal and uploads every document. | | [ListingConnector](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/indexing/template/ListingConnector) | Template connector that performs complete repository list traversals. | |||\n\nInterface for user-specific implementation details of the connector.\n\nImplementations must be thread-safe. Implementations are discouraged from keeping any state\nlocally except perhaps soft-state such as a connection cache. \n\n### Public Method Summary\n\n|---------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract void | [init](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/indexing/IndexingConnector#init(com.google.enterprise.cloudsearch.sdk.indexing.IndexingConnectorContext))([IndexingConnectorContext](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/indexing/IndexingConnectorContext) context) Initializes the connector with the current context. |\n| abstract void | [traverse](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/indexing/IndexingConnector#traverse())() Implements a connector-specific traversal strategy. |\n\n### Inherited Method Summary\n\nFrom interface [com.google.enterprise.cloudsearch.sdk.Connector](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/Connector) \n\n|---------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract void | [destroy](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/Connector#destroy())() Shuts down and releases connector resources. |\n| String | [getDefaultId](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/Connector#getDefaultId())() Gets the default connector ID. |\n| abstract void | [init](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/Connector#init(T))(T context) Initializes the connector with the current context. |\n| abstract void | [saveCheckpoint](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/Connector#saveCheckpoint(boolean))(boolean isShutdown) Saves checkpoint information such as current traversal position or incremental change tokens. |\n| abstract void | [traverse](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/Connector#traverse())() Implements a connector-specific traversal strategy. |\n\nPublic Methods\n--------------\n\n#### public abstract void\n**init**\n([IndexingConnectorContext](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/indexing/IndexingConnectorContext) context)\n\nInitializes the connector with the current context.\n\nInitialization is the ideal time to start any threads to do extra behind-the-scenes work.\nThe `context` allows access to other useful objects that can be used at any time such as\nthe [IndexingService](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/indexing/IndexingService).\n\nIf an unrecoverable fatal error occurs during initialization, throw a [StartupException](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/StartupException) to cancel the startup process. If a recoverable error occurs during\ninitialization, most [Exception](/workspace/cloud-search/docs/reference/sdk/java/lang/Exception) instances other than [StartupException](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/StartupException) cause a\nretry of initialization after a short delay. \n\n##### Parameters\n\n| context | [IndexingConnectorContext](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/indexing/IndexingConnectorContext) instance for accessing framework objects |\n|---------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n\n##### Throws\n\n| Exception | if errors occur during connector initialization |\n|-----------|-------------------------------------------------|\n\n#### public abstract void\n**traverse**\n()\n\nImplements a connector-specific traversal strategy.\n\nUse the [CloudSearch.Indexing.Datasources.Items.Push](https://developers.google.com/resources/api-libraries/documentation/cloudsearch/v1/java/latest/com/google/api/services/cloudsearch/v1/CloudSearch.Indexing.Datasources.Items.Push.html) method to push a list of `PushItem` instances that are to be\nindexed. Often, many of the sent items are unchanged since the last traversal and are thus\nbeing re-pushed unnecessarily. However, the cost of pushing unchanged items is low and doing\nso heals any synchronization errors or cache inconsistencies that might exist in the system.\n\nFor flat or full traversal strategies, push [PushItem](https://developers.google.com/resources/api-libraries/documentation/cloudsearch/v1/java/latest/com/google/api/services/cloudsearch/v1/model/PushItem.html) instances for all items to be\nindexed. For graph traversal strategies, push only the start node of each graph.\n\nAlternatively, a [Connector](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/Connector) implementation can issue an [CloudSearch.Indexing.Datasources.Items.Index](https://developers.google.com/resources/api-libraries/documentation/cloudsearch/v1/java/latest/com/google/api/services/cloudsearch/v1/CloudSearch.Indexing.Datasources.Items.Index.html) for\neach item in the repository instead of using [CloudSearch.Indexing.Datasources.Items.Push](https://developers.google.com/resources/api-libraries/documentation/cloudsearch/v1/java/latest/com/google/api/services/cloudsearch/v1/CloudSearch.Indexing.Datasources.Items.Push.html) and [CloudSearch.Indexing.Datasources.Items.Poll](https://developers.google.com/resources/api-libraries/documentation/cloudsearch/v1/java/latest/com/google/api/services/cloudsearch/v1/CloudSearch.Indexing.Datasources.Items.Poll.html). Such\nimplementations might be suitable for smaller repositories requiring only a periodic full sync.\n\nThis method may take a while and implementations may want to call [sleep(long)](/workspace/cloud-search/docs/reference/sdk/java/lang/Thread#sleep(long))\noccasionally to reduce load.\n\nIf fatal errors occur, throw an [IOException](/workspace/cloud-search/docs/reference/sdk/java/io/IOException) or [RuntimeException](/workspace/cloud-search/docs/reference/sdk/java/lang/RuntimeException).\nIn the case of an error, the [ExceptionHandler](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/ExceptionHandler)\ndefined in [IndexingConnectorContext](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/indexing/IndexingConnectorContext) determines if and when to retry. \n\n##### Throws\n\n| IOException | if getting data access errors |\n| InterruptedException | if an IO operations throws it |\n|----------------------|-------------------------------|"]]