Class SDField

    • Constructor Detail

      • SDField

        protected SDField​(SDDocumentType repo,
                          java.lang.String name,
                          int id,
                          com.yahoo.document.DataType dataType,
                          boolean populate)
        Creates a new field. This method is only used to create reserved fields
        Parameters:
        name - The name of the field
        dataType - The datatype of the field
      • SDField

        public SDField​(SDDocumentType repo,
                       java.lang.String name,
                       int id,
                       com.yahoo.document.DataType dataType)
      • SDField

        public SDField​(SDDocumentType repo,
                       java.lang.String name,
                       com.yahoo.document.DataType dataType,
                       boolean populate)
        Creates a new field.
        Parameters:
        name - The name of the field
        dataType - The datatype of the field
      • SDField

        protected SDField​(SDDocumentType repo,
                          java.lang.String name,
                          com.yahoo.document.DataType dataType,
                          SDDocumentType owner,
                          boolean populate)
        Creates a new field.
        Parameters:
        name - The name of the field
        dataType - The datatype of the field
        owner - the owning document (used to check for id collisions)
      • SDField

        protected SDField​(SDDocumentType repo,
                          java.lang.String name,
                          com.yahoo.document.DataType dataType,
                          SDDocumentType owner,
                          Matching fieldMatching,
                          boolean populate,
                          int recursion)
        Creates a new field.
        Parameters:
        name - The name of the field
        dataType - The datatype of the field
        owner - The owning document (used to check for id collisions)
        fieldMatching - The matching object to set for the field
      • SDField

        public SDField​(SDDocumentType repo,
                       java.lang.String name,
                       com.yahoo.document.DataType dataType)
        Parameters:
        name - The name of the field
        dataType - The datatype of the field
      • SDField

        public SDField​(java.lang.String name,
                       com.yahoo.document.DataType dataType)
    • Method Detail

      • setIsExtraField

        public void setIsExtraField​(boolean isExtra)
      • doesSummarying

        public boolean doesSummarying()
      • containsExpression

        public <T extends com.yahoo.vespa.indexinglanguage.expressions.Expression> boolean containsExpression​(java.lang.Class<T> searchFor)
        Specified by:
        containsExpression in interface ImmutableSDField
      • addSummaryFieldSources

        public void addSummaryFieldSources​(SummaryField summaryField)
      • populateWithStructFields

        public void populateWithStructFields​(SDDocumentType sdoc,
                                             java.lang.String name,
                                             com.yahoo.document.DataType dataType,
                                             int recursion)
      • populateWithStructMatching

        public void populateWithStructMatching​(SDDocumentType sdoc,
                                               java.lang.String name,
                                               com.yahoo.document.DataType dataType,
                                               Matching superFieldMatching)
      • applyOperations

        public void applyOperations()
      • setId

        public void setId​(int fieldId,
                          com.yahoo.document.DocumentType owner)
        Overrides:
        setId in class com.yahoo.document.Field
      • getFirstStructRecursive

        public com.yahoo.document.StructDataType getFirstStructRecursive()
      • parseIndexingScript

        public void parseIndexingScript​(java.lang.String script)
        Parse an indexing expression which will use the simple linguistics implementatino suitable for testing
      • parseIndexingScript

        public void parseIndexingScript​(java.lang.String script,
                                        com.yahoo.language.Linguistics linguistics)
      • setIndexingScript

        public void setIndexingScript​(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:
        getIndexingScript in interface ImmutableSDField
      • setDataType

        public void setDataType​(com.yahoo.document.DataType type)
        Specified by:
        setDataType in interface TypedKey
        Overrides:
        setDataType in class com.yahoo.document.Field
      • setIndexStructureField

        public void setIndexStructureField​(boolean indexStructureField)
      • 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:
        getLiteralBoost in interface ImmutableSDField
      • 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:
        getWeight in interface ImmutableSDField
      • setMatching

        public void setMatching​(Matching matching)
        Sets what kind of matching type should be applied. (Token matching is default, PREFIX, SUBSTRING, SUFFIX are alternatives)
      • setMatchingType

        public void setMatchingType​(Matching.Type type)
        Set the matching type for this field and all subfields.
      • setMatchingAlgorithm

        public void setMatchingAlgorithm​(Matching.Algorithm algorithm)
        Set matching algorithm for this field and all subfields.
      • addIndex

        public void addIndex​(Index index)
        Adds an explicit index defined in this field
      • getIndex

        public Index getIndex​(java.lang.String name)
        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:
        getIndex in interface ImmutableSDField
      • existsIndex

        public boolean existsIndex​(java.lang.String name)
        Returns an index if this field has one (implicitly or explicitly) targeting the given name.
        Specified by:
        existsIndex in interface ImmutableSDField
      • getIndices

        public java.util.Map<java.lang.String,​Index> getIndices()
        Defined indices on this field
        Specified by:
        getIndices in interface ImmutableSDField
        Returns:
        defined indices on this
      • setRankType

        public void setRankType​(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. (This complex behavior is dues to the fact than we would prefer to have rank types per field, not per index)
      • getRanking

        public Ranking getRanking()
        Returns the rank settings set in a "rank" block for this field. This is never null.
        Specified by:
        getRanking in interface ImmutableSDField
      • getRankType

        public RankType getRankType()
        Returns the default rank type of indices of this field, or null if nothing is set
        Specified by:
        getRankType in interface ImmutableSDField
      • getAttributes

        public java.util.Map<java.lang.String,​Attribute> getAttributes()
        Returns the search-time attribute settings of this field or null if none is set.

        TODO: Make unmodifiable.

        Specified by:
        getAttributes in interface ImmutableSDField
      • addAttribute

        public void addAttribute​(Attribute attribute)
      • getStemming

        public Stemming getStemming()
        Returns the stemming setting of this field. Default is determined by the owning search definition.
        Specified by:
        getStemming in interface ImmutableSDField
        Returns:
        the stemming setting of this, or null, to use the default
      • asField

        public com.yahoo.document.Field asField()
        Description copied from interface: ImmutableSDField
        Returns a Field representation (which is sadly not immutable)
        Specified by:
        asField in interface ImmutableSDField
      • setStemming

        public void setStemming​(Stemming stemming)
        Sets how this field should be stemmed, or set to null to use the default.
      • getSummaryFields

        public java.util.Map<java.lang.String,​SummaryField> getSummaryFields()
        Returns an unmodifiable map of the summary fields defined in this
        Specified by:
        getSummaryFields in interface ImmutableSDField
      • removeSummaryFields

        public void removeSummaryFields()
      • addSummaryField

        public void addSummaryField​(SummaryField summaryField)
        Adds a summary field
      • getSummaryField

        public SummaryField getSummaryField​(java.lang.String name)
        Returns a summary field defined (implicitly or explicitly) by this field. Returns null if there is no such summary field defined.
        Specified by:
        getSummaryField in interface ImmutableSDField
      • getSummaryField

        public SummaryField getSummaryField​(java.lang.String name,
                                            boolean create)
        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
      • getStructField

        public SDField getStructField​(java.lang.String name)
        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:
        getStructField in interface ImmutableSDField
      • setNormalizing

        public void setNormalizing​(NormalizeLevel level)
        Change how the content of this field should be accent normalized etc
      • addQueryCommand

        public void addQueryCommand​(java.lang.String name)
      • hasQueryCommand

        public boolean hasQueryCommand​(java.lang.String name)
      • getQueryCommands

        public java.util.List<java.lang.String> getQueryCommands()
        Returns a list of query commands
        Specified by:
        getQueryCommands in interface ImmutableSDField
      • equals

        public boolean equals​(java.lang.Object other)
        Overrides:
        equals in class com.yahoo.document.Field
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class com.yahoo.document.Field
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class com.yahoo.document.Field
      • getAliasToName

        public java.util.Map<java.lang.String,​java.lang.String> getAliasToName()
        The aliases declared for this field
        Specified by:
        getAliasToName in interface ImmutableSDField