Package com.yahoo.schema.document
Class SDField
java.lang.Object
com.yahoo.vespa.objects.FieldBase
com.yahoo.document.Field
com.yahoo.schema.document.SDField
- All Implemented Interfaces:
com.yahoo.document.fieldset.FieldSet,ImmutableSDField,Comparable<com.yahoo.document.Field>
- Direct Known Subclasses:
TemporarySDField
The field class represents a document field. It is used in
the Document class to get and set fields. Each SDField has a name, a numeric ID,
a data type. The numeric ID is used when the fields are stored
in serialized form.
- Author:
- bratseth
-
Field Summary
Fields inherited from class com.yahoo.document.Field
dataType, fieldId -
Constructor Summary
ConstructorsModifierConstructorDescriptionSDField(SDDocumentType repo, String name, int id, com.yahoo.document.DataType dataType) Creates a new field.SDField(SDDocumentType repo, String name, com.yahoo.document.DataType dataType) Creates a new fieldprotectedSDField(SDDocumentType repo, String name, com.yahoo.document.DataType dataType, SDDocumentType owner) Creates a new fieldprotectedSDField(SDDocumentType repo, String name, com.yahoo.document.DataType dataType, SDDocumentType owner, Matching fieldMatching, int recursion) Creates a new field -
Method Summary
Modifier and TypeMethodDescriptionaddAttribute(Attribute attribute) Adds an explicit index defined in this fieldvoidaddQueryCommand(String name) voidaddSummaryField(SummaryField summaryField) Adds a summary fieldvoidaddSummaryFieldSources(SummaryField summaryField) com.yahoo.document.FieldasField()Returns aFieldrepresentation (which is sadly not immutable)<T extends com.yahoo.vespa.indexinglanguage.expressions.Expression>
booleancontainsExpression(Class<T> searchFor) booleanbooleanReturns true if (there is strong evidence that) the value stored by this field is bit-packed.booleanbooleanbooleanbooleanbooleanexistsIndex(String name) Returns an index if this field has one (implicitly or explicitly) targeting the given name.The aliases declared for this fieldReturns the search-time attribute settings of this field or null if none is set.Returns Dictionary settings.com.yahoo.document.StructDataTypeReturns an index, or null if no index with this name has had some explicit settings applied in this field (even if this returns null, the index may be implicitly defined by an indexing statement)com.yahoo.vespa.indexinglanguage.expressions.ScriptExpressionDefined indices on this field.intReturns the literal boost of this field.Returns what kind of matching type should be applied.Returns how the content of this field should be accent normalized etcReturns a list of query commandsReturns the rank settings set in a "rank" block for this field.Returns the default rank type of indices of this field, or null if nothing is setReturns the stemming setting of this field.getStemming(Schema schema) Whether this field should be stemmed in this schemagetStructField(String name) Returns a struct field defined in this field, potentially traversing into nested structs.Returns list of static struct fieldsgetSummaryField(String name) Returns a summary field defined (implicitly or explicitly) by this field.getSummaryField(String name, boolean create) Returns a summary field defined (implicitly or explicitly) by this field.Returns an unmodifiable map of the summary fields defined in thisintReturns the weight of this field, or 0 if nothing is setbooleanReturns true if this is a document field (not a synthetic field), or a mutable attribute.inthashCode()booleanhasIndex()booleanhasQueryCommand(String name) booleanReturns whether this field has a single attribute with the same name as this field.booleanbooleanbooleanbooleanvoidparseIndexingScript(String schemaName, String script) Parse an indexing expression which will use the simple linguistics implementation suitable for testingvoidparseIndexingScript(String schemaName, String script, com.yahoo.language.Linguistics linguistics, Map<String, com.yahoo.language.process.Chunker> chunkers, Map<String, com.yahoo.language.process.Embedder> embedders, Map<String, com.yahoo.language.process.FieldGenerator> generators) voidvoidsetDataType(com.yahoo.document.DataType type) voidsetId(int fieldId, com.yahoo.document.DocumentType owner) voidsetIndexingScript(String schemaName, com.yahoo.vespa.indexinglanguage.expressions.ScriptExpression exp) Sets the indexing script of this, or null to not use a scriptvoidsetIndexStructureField(boolean indexStructureField) voidsetIsExtraField(boolean isExtra) voidsetLiteralBoost(int literalBoost) Sets the literal boost of this fieldvoidsetMatching(Matching matching) Sets what kind of matching type should be applied.voidsetMatchingAlgorithm(MatchAlgorithm algorithm) Set matching algorithm for this field and all subfields.voidsetMatchingCase(Case casing) Set the matching type for this field and all subfields.voidsetMatchingType(MatchType type) Set the matching type for this field and all subfields.voidsetNormalizing(NormalizeLevel level) Change how the content of this field should be accent normalized etcvoidsetRankType(RankType rankType) Sets the default rank type of this fields indices, and sets this rank type to all indices explicitly defined here which has no index set.voidsetStemming(Stemming stemming) Sets how this field should be stemmed, or set to null to use the default.voidsetWeight(int weight) Sets the weight of this fieldtoString()booleanbooleanWhether this field at some time was configured to do attributing.booleanWhether this field at some time was configured to do indexing.Methods inherited from class com.yahoo.document.Field
calculateIdV7, clone, compareTo, contains, getDataType, getId, hasForcedIdMethods inherited from class com.yahoo.vespa.objects.FieldBase
getNameMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.yahoo.schema.document.ImmutableSDField
getDataType, getName
-
Constructor Details
-
SDField
Creates a new field. This method is only used to create reserved fields.- Parameters:
name- the name of the fielddataType- the datatype of the field
-
SDField
-
SDField
Creates a new field -
SDField
protected SDField(SDDocumentType repo, String name, com.yahoo.document.DataType dataType, SDDocumentType owner) Creates a new field -
SDField
protected SDField(SDDocumentType repo, String name, com.yahoo.document.DataType dataType, SDDocumentType owner, Matching fieldMatching, int recursion) Creates a new field- Parameters:
name- the name of the fielddataType- the datatype of the fieldowner- the owning document (used to check for id collisions)fieldMatching- the matching object to set for the field
-
-
Method Details
-
setIsExtraField
public void setIsExtraField(boolean isExtra) -
isExtraField
public boolean isExtraField()- Specified by:
isExtraFieldin interfaceImmutableSDField
-
isDocumentField
public boolean isDocumentField() -
isImportedField
public boolean isImportedField()- Specified by:
isImportedFieldin interfaceImmutableSDField
-
doesAttributing
public boolean doesAttributing()- Specified by:
doesAttributingin interfaceImmutableSDField
-
doesIndexing
public boolean doesIndexing()- Specified by:
doesIndexingin interfaceImmutableSDField
-
doesBitPacking
public boolean doesBitPacking()Returns true if (there is strong evidence that) the value stored by this field is bit-packed.- Specified by:
doesBitPackingin interfaceImmutableSDField
-
doesSummarying
public boolean doesSummarying() -
doesLowerCasing
public boolean doesLowerCasing()- Specified by:
doesLowerCasingin interfaceImmutableSDField
-
containsExpression
public <T extends com.yahoo.vespa.indexinglanguage.expressions.Expression> boolean containsExpression(Class<T> searchFor) - Specified by:
containsExpressionin interfaceImmutableSDField
-
addSummaryFieldSources
-
setId
public void setId(int fieldId, com.yahoo.document.DocumentType owner) - Overrides:
setIdin classcom.yahoo.document.Field
-
getFirstStructRecursive
public com.yahoo.document.StructDataType getFirstStructRecursive() -
usesStructOrMap
public boolean usesStructOrMap()- Specified by:
usesStructOrMapin interfaceImmutableSDField
-
wasConfiguredToDoAttributing
public boolean wasConfiguredToDoAttributing()Description copied from interface:ImmutableSDFieldWhether this field at some time was configured to do attributing. This function can typically return a different value than doesAttributing(), which uses the final state of the underlying indexing script instead.- Specified by:
wasConfiguredToDoAttributingin interfaceImmutableSDField
-
wasConfiguredToDoIndexing
public boolean wasConfiguredToDoIndexing()Description copied from interface:ImmutableSDFieldWhether this field at some time was configured to do indexing. This function can typically return a different value than doesIndexing(), which uses the final state of the underlying indexing script instead.- Specified by:
wasConfiguredToDoIndexingin interfaceImmutableSDField
-
hasSingleAttribute
public boolean hasSingleAttribute()Description copied from interface:ImmutableSDFieldReturns whether this field has a single attribute with the same name as this field.- Specified by:
hasSingleAttributein interfaceImmutableSDField
-
parseIndexingScript
Parse an indexing expression which will use the simple linguistics implementation suitable for testing -
parseIndexingScript
-
setIndexingScript
public void setIndexingScript(String schemaName, com.yahoo.vespa.indexinglanguage.expressions.ScriptExpression exp) Sets the indexing script of this, or null to not use a script -
getIndexingScript
public com.yahoo.vespa.indexinglanguage.expressions.ScriptExpression getIndexingScript()- Specified by:
getIndexingScriptin interfaceImmutableSDField
-
setDataType
public void setDataType(com.yahoo.document.DataType type) - Overrides:
setDataTypein classcom.yahoo.document.Field
-
isIndexStructureField
public boolean isIndexStructureField()- Specified by:
isIndexStructureFieldin interfaceImmutableSDField
-
setIndexStructureField
public void setIndexStructureField(boolean indexStructureField) -
hasIndex
public boolean hasIndex()- Specified by:
hasIndexin interfaceImmutableSDField
-
setLiteralBoost
public void setLiteralBoost(int literalBoost) Sets the literal boost of this field -
getLiteralBoost
public int getLiteralBoost()Returns the literal boost of this field. This boost is added to a literal score when a query term matched as query term exactly (unnormalized and unstemmed). Default is non-positive.- Specified by:
getLiteralBoostin interfaceImmutableSDField
-
setWeight
public void setWeight(int weight) Sets the weight of this field -
getWeight
public int getWeight()Returns the weight of this field, or 0 if nothing is set- Specified by:
getWeightin interfaceImmutableSDField
-
getMatching
Returns what kind of matching type should be applied.- Specified by:
getMatchingin interfaceImmutableSDField
-
setMatching
Sets what kind of matching type should be applied. (Token matching is default, PREFIX, SUBSTRING, SUFFIX are alternatives) -
getDictionary
Returns Dictionary settings. -
getOrSetDictionary
-
setMatchingType
Set the matching type for this field and all subfields. -
setMatchingCase
Set the matching type for this field and all subfields. -
setMatchingAlgorithm
Set matching algorithm for this field and all subfields. -
addIndex
Adds an explicit index defined in this field -
getIndex
Returns an index, or null if no index with this name has had some explicit settings applied in this field (even if this returns null, the index may be implicitly defined by an indexing statement)- Specified by:
getIndexin interfaceImmutableSDField
-
existsIndex
Returns an index if this field has one (implicitly or explicitly) targeting the given name.- Specified by:
existsIndexin interfaceImmutableSDField
-
getIndices
Defined indices on this field.- Specified by:
getIndicesin interfaceImmutableSDField- Returns:
- defined indices on this
-
setRankType
Sets the default rank type of this fields indices, and sets this rank type to all indices explicitly defined here which has no index set. (This complex behavior is dues to the fact than we would prefer to have rank types per field, not per index) -
getRanking
Returns the rank settings set in a "rank" block for this field. This is never null.- Specified by:
getRankingin interfaceImmutableSDField
-
getRankType
Returns the default rank type of indices of this field, or null if nothing is set- Specified by:
getRankTypein interfaceImmutableSDField
-
getAttributes
Returns the search-time attribute settings of this field or null if none is set.- Specified by:
getAttributesin interfaceImmutableSDField
-
getAttribute
- Specified by:
getAttributein interfaceImmutableSDField
-
addAttribute
-
getStemming
Returns the stemming setting of this field. Default is determined by the owning schema.- Specified by:
getStemmingin interfaceImmutableSDField- Returns:
- the stemming setting of this, or null, to use the default
-
getStemming
Whether this field should be stemmed in this schema- Specified by:
getStemmingin interfaceImmutableSDField
-
asField
public com.yahoo.document.Field asField()Description copied from interface:ImmutableSDFieldReturns aFieldrepresentation (which is sadly not immutable)- Specified by:
asFieldin interfaceImmutableSDField
-
setStemming
Sets how this field should be stemmed, or set to null to use the default. -
getSummaryFields
Returns an unmodifiable map of the summary fields defined in this- Specified by:
getSummaryFieldsin interfaceImmutableSDField
-
removeSummaryFields
public void removeSummaryFields() -
addSummaryField
Adds a summary field -
getSummaryField
Returns a summary field defined (implicitly or explicitly) by this field. Returns null if there is no such summary field defined.- Specified by:
getSummaryFieldin interfaceImmutableSDField
-
getSummaryField
Returns a summary field defined (implicitly or explicitly) by this field.- Parameters:
create- true to create the summary field and add it to this field before returning if it is missing- Returns:
- the summary field, or null if not present and create is false
-
getStructFields
Returns list of static struct fields- Specified by:
getStructFieldsin interfaceImmutableSDField
-
getStructField
Returns a struct field defined in this field, potentially traversing into nested structs. Returns null if there is no such struct field defined.- Specified by:
getStructFieldin interfaceImmutableSDField
-
getNormalizing
Returns how the content of this field should be accent normalized etc- Specified by:
getNormalizingin interfaceImmutableSDField
-
setNormalizing
Change how the content of this field should be accent normalized etc -
addQueryCommand
-
hasQueryCommand
-
getQueryCommands
Returns a list of query commands- Specified by:
getQueryCommandsin interfaceImmutableSDField
-
equals
- Overrides:
equalsin classcom.yahoo.document.Field
-
hashCode
public int hashCode()- Overrides:
hashCodein classcom.yahoo.document.Field
-
toString
- Overrides:
toStringin classcom.yahoo.document.Field
-
getAliasToName
The aliases declared for this field- Specified by:
getAliasToNamein interfaceImmutableSDField
-
hasFullIndexingDocprocRights
public boolean hasFullIndexingDocprocRights()Description copied from interface:ImmutableSDFieldReturns true if this is a document field (not a synthetic field), or a mutable attribute.- Specified by:
hasFullIndexingDocprocRightsin interfaceImmutableSDField
-