Class SDDocumentType
- java.lang.Object
-
- com.yahoo.searchdefinition.document.SDDocumentType
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
- Direct Known Subclasses:
TemporarySDDocumentType
public class SDDocumentType extends java.lang.Object implements java.lang.Cloneable, java.io.Serializable
A document definition is a list of fields. Documents may inherit other documents, implicitly acquiring their fields as it's own. If a document is not set to inherit any document, it will always inherit the document "document.0".- Author:
- Thomas Gundersen, bratseth
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static SDDocumentType
VESPA_DOCUMENT
-
Constructor Summary
Constructors Constructor Description SDDocumentType(com.yahoo.document.DataTypeName name)
SDDocumentType(java.lang.String name)
Creates a new document type.SDDocumentType(java.lang.String name, Search search)
Creates a new document type.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SDDocumentType
addAnnotation(com.yahoo.document.annotation.AnnotationType annotation)
void
addField(com.yahoo.document.Field field)
SDField
addField(java.lang.String string, com.yahoo.document.DataType dataType)
com.yahoo.document.Field
addField(java.lang.String string, com.yahoo.document.DataType dataType, boolean header, int code)
SDDocumentType
addType(SDDocumentType dt)
For adding structs defined in document scopeSDDocumentType
clone()
java.util.Iterator<com.yahoo.document.Field>
fieldIterator()
java.util.Set<com.yahoo.document.Field>
fieldSet()
com.yahoo.document.annotation.AnnotationType
findAnnotation(java.lang.String name)
java.util.Collection<SDDocumentType>
getAllTypes()
java.util.Collection<com.yahoo.document.annotation.AnnotationType>
getAnnotations()
com.yahoo.document.DataTypeName
getDocumentName()
java.util.Optional<DocumentReferences>
getDocumentReferences()
com.yahoo.document.DocumentType
getDocumentType()
com.yahoo.document.Field
getField(java.lang.String name)
Override getField, as it may need to ask inherited types that isn't registered in document type.int
getFieldCount()
FieldSets
getFieldSets()
The field sets defined for this type and itsSearch
java.util.Collection<SDDocumentType>
getInheritedTypes()
java.lang.String
getName()
SDDocumentType
getOwnedType(com.yahoo.document.DataTypeName name)
SDDocumentType
getOwnedType(NewDocumentType.Name name)
SDDocumentType
getOwnedType(java.lang.String name)
com.yahoo.document.DataType
getStruct()
TemporaryImportedFields
getTemporaryImportedFields()
SDDocumentType
getType(NewDocumentType.Name name)
SDDocumentType
getType(java.lang.String name)
java.util.Collection<SDDocumentType>
getTypes()
Access to all owned datatypes.void
inherit(com.yahoo.document.DataTypeName name)
void
inherit(SDDocumentType type)
boolean
isStruct()
void
setDocumentReferences(DocumentReferences documentReferences)
void
setFieldId(SDField field, int id)
void
setFieldSets(FieldSets fieldSets)
Sets the field sets for thisSDDocumentType
setStruct(com.yahoo.document.DataType structType)
void
setTemporaryImportedFields(TemporaryImportedFields temporaryImportedFields)
java.lang.String
toString()
protected void
validateId(Search search)
-
-
-
Field Detail
-
VESPA_DOCUMENT
public static final SDDocumentType VESPA_DOCUMENT
-
-
Constructor Detail
-
SDDocumentType
public SDDocumentType(java.lang.String name)
Creates a new document type. The document type id will be generated as a hash from the document type name.- Parameters:
name
- The name of the new document type
-
SDDocumentType
public SDDocumentType(com.yahoo.document.DataTypeName name)
-
SDDocumentType
public SDDocumentType(java.lang.String name, Search search)
Creates a new document type. The document type id will be generated as a hash from the document type name.- Parameters:
name
- The name of the new document typesearch
- check for type ID collisions in this search definition
-
-
Method Detail
-
clone
public SDDocumentType clone() throws java.lang.CloneNotSupportedException
- Overrides:
clone
in classjava.lang.Object
- Throws:
java.lang.CloneNotSupportedException
-
addType
public SDDocumentType addType(SDDocumentType dt)
For adding structs defined in document scope- Parameters:
dt
- The struct to add.- Returns:
- self, for chaining
-
getOwnedType
public final SDDocumentType getOwnedType(java.lang.String name)
-
getOwnedType
public SDDocumentType getOwnedType(com.yahoo.document.DataTypeName name)
-
getOwnedType
public SDDocumentType getOwnedType(NewDocumentType.Name name)
-
getType
public final SDDocumentType getType(java.lang.String name)
-
getType
public SDDocumentType getType(NewDocumentType.Name name)
-
addAnnotation
public SDDocumentType addAnnotation(com.yahoo.document.annotation.AnnotationType annotation)
-
getTypes
public java.util.Collection<SDDocumentType> getTypes()
Access to all owned datatypes.- Returns:
- all types
-
getAnnotations
public java.util.Collection<com.yahoo.document.annotation.AnnotationType> getAnnotations()
-
findAnnotation
public com.yahoo.document.annotation.AnnotationType findAnnotation(java.lang.String name)
-
getAllTypes
public java.util.Collection<SDDocumentType> getAllTypes()
-
isStruct
public boolean isStruct()
-
getStruct
public com.yahoo.document.DataType getStruct()
-
setStruct
public SDDocumentType setStruct(com.yahoo.document.DataType structType)
-
getName
public java.lang.String getName()
-
getDocumentName
public com.yahoo.document.DataTypeName getDocumentName()
-
getDocumentType
public com.yahoo.document.DocumentType getDocumentType()
-
inherit
public void inherit(com.yahoo.document.DataTypeName name)
-
inherit
public void inherit(SDDocumentType type)
-
getInheritedTypes
public java.util.Collection<SDDocumentType> getInheritedTypes()
-
validateId
protected void validateId(Search search)
-
setFieldId
public void setFieldId(SDField field, int id)
-
getField
public com.yahoo.document.Field getField(java.lang.String name)
Override getField, as it may need to ask inherited types that isn't registered in document type.- Parameters:
name
- Name of field to get.- Returns:
- The field found.
-
addField
public void addField(com.yahoo.document.Field field)
-
addField
public SDField addField(java.lang.String string, com.yahoo.document.DataType dataType)
-
addField
public com.yahoo.document.Field addField(java.lang.String string, com.yahoo.document.DataType dataType, boolean header, int code)
-
fieldSet
public java.util.Set<com.yahoo.document.Field> fieldSet()
-
fieldIterator
public java.util.Iterator<com.yahoo.document.Field> fieldIterator()
-
getFieldCount
public int getFieldCount()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
setFieldSets
public void setFieldSets(FieldSets fieldSets)
Sets the field sets for this
-
getDocumentReferences
public java.util.Optional<DocumentReferences> getDocumentReferences()
-
setDocumentReferences
public void setDocumentReferences(DocumentReferences documentReferences)
-
getTemporaryImportedFields
public TemporaryImportedFields getTemporaryImportedFields()
-
setTemporaryImportedFields
public void setTemporaryImportedFields(TemporaryImportedFields temporaryImportedFields)
-
-