IndexingItemBuilder

public class IndexingItemBuilder extends Object

Helper object to build an Item.

Use the setters to provide all desired attributes of an Item including the name, ACL, metadata fields, queue, version, and so on. To set the attribute’s value explicitly at build time (value) or derive it from the repository’s map of key/values (field), define the metadata fields as IndexingItemBuilder.FieldOrValue objects.

Sample usage:

// within Repository method fetching a document
   Multimap<String, Object> multiMapValues = ... // populate the map with repository data
   String documentName = ... // create the specific document name (unique id)
   String documentTitle = ... // set title to a "field" in multiMapValues
   ...
   IndexingItemBuilder indexingItemBuilder =
       IndexingItemBuilder.fromConfiguration(documentName).setValues(multiMapValues);
   ...
   // the title is now set to the value of the title field during the build()
   indexingItemBuilder.setTitle(FieldOrValue.withField(documentTitle));
   ...
   // the URL is now set to the hard-coded URL string
   indexingItemBuilder.setSourceRepositoryUrl(FieldOrValue.withValue("https://www.mycompany.com");
   ...
   // generate the fully built document
   Item documentItem = indexingItemBuilder.build();
   ...
   
 

Nested Class Summary

class IndexingItemBuilder.FieldOrValue<T> Construct to specify an actual field value or pointer to a key within the key/values map. 
enum IndexingItemBuilder.ItemType  

Constant Summary

String OBJECT_TYPE

Field Summary

public static final String CONTENT_LANGUAGE_FIELD
public static final String CONTENT_LANGUAGE_VALUE
public static final String CREATE_TIME_FIELD
public static final String CREATE_TIME_VALUE
public static final String SOURCE_REPOSITORY_URL_FIELD
public static final String SOURCE_REPOSITORY_URL_VALUE
public static final String TITLE_FIELD
public static final String TITLE_VALUE
public static final String UPDATE_TIME_FIELD
public static final String UPDATE_TIME_VALUE

Public Constructor Summary

IndexingItemBuilder(String name)
Constructs an empty IndexingItemBuilder.

Public Method Summary

Item
build()
Builds the Item using all of the previously set attributes.
static IndexingItemBuilder
fromConfiguration(String name)
Constructs an IndexingItemBuilder from the Configuration.
IndexingItemBuilder
setAcl(Acl acl)
IndexingItemBuilder
setContainerName(String container)
IndexingItemBuilder
setContentLanguage(FieldOrValue<String> language)
IndexingItemBuilder
setCreateTime(FieldOrValue<DateTime> createTime)
IndexingItemBuilder
setHash(String hash)
IndexingItemBuilder
IndexingItemBuilder
setMimeType(String mimeType)
IndexingItemBuilder
setObjectType(String objectType)
IndexingItemBuilder
setPayload(byte[] payload)
IndexingItemBuilder
setQueue(String queue)
IndexingItemBuilder
setSearchQualityMetadata(SearchQualityMetadata searchQuality)
IndexingItemBuilder
IndexingItemBuilder
setTitle(FieldOrValue<String> title)
IndexingItemBuilder
setUpdateTime(FieldOrValue<DateTime> updateTime)
IndexingItemBuilder
setValues(Multimap<String, Object> values)
IndexingItemBuilder
setVersion(byte[] version)

Inherited Method Summary

Constants

public static final String OBJECT_TYPE

Constant Value: "itemMetadata.objectType"

Fields

public static final String CONTENT_LANGUAGE_FIELD

public static final String CONTENT_LANGUAGE_VALUE

public static final String CREATE_TIME_FIELD

public static final String CREATE_TIME_VALUE

public static final String SOURCE_REPOSITORY_URL_FIELD

public static final String SOURCE_REPOSITORY_URL_VALUE

public static final String TITLE_FIELD

public static final String TITLE_VALUE

public static final String UPDATE_TIME_FIELD

public static final String UPDATE_TIME_VALUE

Public Constructors

public IndexingItemBuilder (String name)

Constructs an empty IndexingItemBuilder.

Parameters
name

Public Methods

public Item build ()

Builds the Item using all of the previously set attributes.

Aside from the name and values map, all of the attributes are optional. The metadata attributes (title, sourceRepositoryUrl, updateTime, createTime, contentLanguage) can be set explicitly in the setter, from the values map, or using the configuration properties.

Returns
  • fully built Item object

public static IndexingItemBuilder fromConfiguration (String name)

Constructs an IndexingItemBuilder from the Configuration.

Optional configuration parameters for ItemMetadata:

  • itemMetadata.title.field - The key for the title field in the values map.
  • itemMetadata.sourceRepositoryUrl.field - The key for the URL field in the values map.
  • itemMetadata.updateTime.field - The key for the update time field in the values map.
  • itemMetadata.createTime.field - The key for the create time field in the values map.
  • itemMetadata.contentLanguage.field - The key for the content language field in the values map.
  • itemMetadata.title.defaultValue - The value for the title.
  • itemMetadata.sourceRepositoryUrl.defaultValue - The value for the URL.
  • itemMetadata.updateTime.defaultValue - The value for the update time in RFC 3339 format.
  • itemMetadata.createTime.defaultValue - The value for the create time in RFC 3339 format.
  • itemMetadata.contentLanguage.defaultValue - The value for the content language. Note: For each ItemMetadata field, check the following in order for a non-empty value:
    1. A call to the correponding setter method on the returned instance of IndexingItemBuilder.
    2. A config property with a suffix of .field, used as a key into the the values map.
    3. A config property with a suffix of .defaultValue.

    Optional configuration parameters for StructuredData:

    • itemMetadata.objectType - Specifies the object type from the schema to use for structured data.

Parameters
name

public IndexingItemBuilder setAcl (Acl acl)

Parameters
acl

public IndexingItemBuilder setContainerName (String container)

Parameters
container

public IndexingItemBuilder setContentLanguage (FieldOrValue<String> language)

Parameters
language

public IndexingItemBuilder setCreateTime (FieldOrValue<DateTime> createTime)

Parameters
createTime

public IndexingItemBuilder setHash (String hash)

Parameters
hash

public IndexingItemBuilder setItemType (IndexingItemBuilder.ItemType itemType)

Parameters
itemType

public IndexingItemBuilder setMimeType (String mimeType)

Parameters
mimeType

public IndexingItemBuilder setObjectType (String objectType)

Parameters
objectType

public IndexingItemBuilder setPayload (byte[] payload)

Parameters
payload

public IndexingItemBuilder setQueue (String queue)

Parameters
queue

public IndexingItemBuilder setSearchQualityMetadata (SearchQualityMetadata searchQuality)

Parameters
searchQuality

public IndexingItemBuilder setSourceRepositoryUrl (FieldOrValue<String> url)

Parameters
url

public IndexingItemBuilder setTitle (FieldOrValue<String> title)

Parameters
title

public IndexingItemBuilder setUpdateTime (FieldOrValue<DateTime> updateTime)

Parameters
updateTime

public IndexingItemBuilder setValues (Multimap<String, Object> values)

Parameters
values

public IndexingItemBuilder setVersion (byte[] version)

Parameters
version

Send feedback about...

Cloud Search
Cloud Search