Class SearchMetadataCollection
java.lang.Object
org.opencastproject.elasticsearch.impl.SearchMetadataCollection
- All Implemented Interfaces:
Iterable<SearchMetadata<?>>,Collection<SearchMetadata<?>>
Wrapper that facilitates in posting business objects to the search index.
This implementation provides utility methods that will ease handling of objects such as dates or users and help
prevent posting of null values.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected StringReturns the document typeprotected StringReturns the document identifierprotected Map<String, SearchMetadata<?>> The metadata -
Constructor Summary
ConstructorsConstructorDescriptionSearchMetadataCollection(String documentType) Creates a new resource metadata collection for the given document type.SearchMetadataCollection(String identifier, String documentType) Creates a new resource metadata collection for the given document type. -
Method Summary
Modifier and TypeMethodDescriptionbooleanadd(SearchMetadata<?> e) booleanaddAll(Collection<? extends SearchMetadata<?>> c) voidAdds the field and its value to the search index.voidclear()booleanbooleancontainsAll(Collection<?> c) Returns the document type that determines where the document is posted to the index.Returns the document identifier.protected StringgetLocalizedFieldName(String fieldName, Language language) Returns the localized field name, which is the original field name extended by an underscore and the language identifier.List<SearchMetadata<?>> Returns the metadata as a list ofSearchMetadataitems.booleanisEmpty()iterator()booleanbooleanremoveAll(Collection<?> c) booleanretainAll(Collection<?> c) voidsetIdentifier(String identifier) Sets the document identifier.intsize()Object[]toArray()<T> T[]toArray(T[] arg0) Map<String, SearchMetadata<?>> toMap()Returns the metadata keys and the metadata items as a map for convenient access of search metadata by key.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Collection
equals, hashCode, parallelStream, removeIf, spliterator, stream, toArray
-
Field Details
-
metadata
The metadata -
identifier
Returns the document identifier -
documentType
Returns the document type
-
-
Constructor Details
-
SearchMetadataCollection
Creates a new resource metadata collection for the given document type.Make sure to set the identifier after the fact using
setIdentifier(String).- Parameters:
documentType- the document type
-
SearchMetadataCollection
Creates a new resource metadata collection for the given document type.- Parameters:
identifier- the document identifierdocumentType- the document type
-
-
Method Details
-
setIdentifier
Sets the document identifier.- Parameters:
identifier- the identifier
-
getIdentifier
Returns the document identifier.- Returns:
- the identifier
-
getDocumentType
Returns the document type that determines where the document is posted to the index.- Returns:
- the document type
-
addField
Adds the field and its value to the search index.- Parameters:
fieldName- the field namefieldValue- the valueaddToText-trueto add the contents to the fulltext field as well
-
getLocalizedFieldName
Returns the localized field name, which is the original field name extended by an underscore and the language identifier.- Parameters:
fieldName- the field namelanguage- the language- Returns:
- the localized field name
-
getMetadata
Returns the metadata as a list ofSearchMetadataitems.- Returns:
- the metadata items
-
add
- Specified by:
addin interfaceCollection<SearchMetadata<?>>- See Also:
-
addAll
- Specified by:
addAllin interfaceCollection<SearchMetadata<?>>- See Also:
-
clear
public void clear()- Specified by:
clearin interfaceCollection<SearchMetadata<?>>- See Also:
-
contains
- Specified by:
containsin interfaceCollection<SearchMetadata<?>>- See Also:
-
containsAll
- Specified by:
containsAllin interfaceCollection<SearchMetadata<?>>- See Also:
-
isEmpty
public boolean isEmpty()- Specified by:
isEmptyin interfaceCollection<SearchMetadata<?>>- See Also:
-
iterator
- Specified by:
iteratorin interfaceCollection<SearchMetadata<?>>- Specified by:
iteratorin interfaceIterable<SearchMetadata<?>>- See Also:
-
remove
- Specified by:
removein interfaceCollection<SearchMetadata<?>>- See Also:
-
removeAll
- Specified by:
removeAllin interfaceCollection<SearchMetadata<?>>- See Also:
-
retainAll
- Specified by:
retainAllin interfaceCollection<SearchMetadata<?>>- See Also:
-
size
public int size()- Specified by:
sizein interfaceCollection<SearchMetadata<?>>- See Also:
-
toArray
- Specified by:
toArrayin interfaceCollection<SearchMetadata<?>>- See Also:
-
toMap
Returns the metadata keys and the metadata items as a map for convenient access of search metadata by key.- Returns:
- the map
-
toArray
public <T> T[] toArray(T[] arg0) - Specified by:
toArrayin interfaceCollection<SearchMetadata<?>>- See Also:
-