Class SDParser

    • Field Detail

      • token

        public Token token
        Current token.
      • jj_nt

        public Token jj_nt
        Next token.
    • Constructor Detail

      • SDParser

        public SDParser​(java.lang.String input,
                        com.yahoo.config.application.api.DeployLogger deployLogger)
        For testing only
      • SDParser

        public SDParser​(SimpleCharStream stream,
                        com.yahoo.config.application.api.DeployLogger deployLogger)
        For testing only
      • SDParser

        public SDParser​(SimpleCharStream stream,
                        com.yahoo.config.application.api.DeployLogger deployLogger,
                        com.yahoo.config.application.api.ApplicationPackage applicationPackage,
                        RankProfileRegistry rankProfileRegistry,
                        boolean documentsOnly)
        Creates a parser
        Parameters:
        documentsOnly - true to only parse the document aspect of a search definition (e.g skip rank profiles)
      • SDParser

        public SDParser​(CharStream stream)
        Constructor with user supplied CharStream.
        Parameters:
        stream - stream to init with
      • SDParser

        public SDParser​(SDParserTokenManager tm)
        Constructor with generated Token Manager.
        Parameters:
        tm - Token manager to use
    • Method Detail

      • search

        public final Search search​(com.yahoo.document.DocumentTypeManager docMan,
                                   java.lang.String dir)
                            throws ParseException
        The rule consumes any search definition and returns the corresponding object. This is the only production that should ever consume leading newlines.
        Parameters:
        dir - The directory containing the file being parsed.
        Returns:
        The search definition object.
        Throws:
        ParseException
      • rootSchema

        public final Search rootSchema​(java.lang.String dir)
                                throws ParseException
        This rule consumes a proper schema block. This and rootDocument() are the only rules that should ever consume trailing newline tokens.
        Parameters:
        dir - the directory containing the file being parsed.
        Returns:
        the schema definition object.
        Throws:
        ParseException
      • rootSchemaItem

        public final java.lang.Object rootSchemaItem​(Search search)
                                              throws ParseException
        Consumes an element of a schema block. This and rootSearch() are the only rules that should ever consume trailing newline tokens.
        Parameters:
        search - The search object to modify.
        Returns:
        Null.
        Throws:
        ParseException
      • rootDocument

        public final Search rootDocument​(java.lang.String dir)
                                  throws ParseException
        Consumes a schema definition that contains only documents to be used for inheritance, etc.
        Parameters:
        dir - the directory containing the file being parsed.
        Returns:
        the schema definition object.
        Throws:
        ParseException
      • rootDocumentItem

        public final java.lang.Object rootDocumentItem​(Search search)
                                                throws ParseException
        Consumes a single item from within a root document node.
        Parameters:
        search - The search object to modify.
        Returns:
        Null.
        Throws:
        ParseException
      • useDocument

        public final void useDocument​(Search search)
                               throws ParseException
        Consumes a use-document statement. This currently does nothing.
        Parameters:
        search - the search object to modify.
        Throws:
        ParseException
      • document

        public final void document​(Search search)
                            throws ParseException
        Consumes a document element. The name defaults to the search's name, but may be set.
        Parameters:
        search - the search object to add content to.
        Throws:
        ParseException
      • namedDocument

        public final void namedDocument​(Search search)
                                 throws ParseException
        Consumes a document element, explicitly named
        Parameters:
        search - the search object to add content to.
        Throws:
        ParseException
      • documentBody

        public final java.lang.Object documentBody​(SDDocumentType document,
                                                   Search search)
                                            throws ParseException
        Consumes a document body block
        Parameters:
        document - The document type to modify.
        search - The search object to add content to.
        Returns:
        Null.
        Throws:
        ParseException
      • compression

        public final void compression​(SDDocumentType document,
                                      java.lang.String name)
                               throws ParseException
        Consumes a compression block. This can be set in both document header and -body block.
        Parameters:
        document - The document type to modify.
        name - The name of the document block to modify.
        Throws:
        ParseException
      • compressionItem

        public final com.yahoo.document.CompressionConfig compressionItem​(com.yahoo.document.CompressionConfig cfg)
                                                                   throws ParseException
        Consumes the body of a compression block.
        Parameters:
        cfg - The compression config to modify.
        Throws:
        ParseException
      • inheritsDocument

        public final void inheritsDocument​(SDDocumentType document)
                                    throws ParseException
        Consumes a document inheritance statement.
        Parameters:
        document - The document type to modify.
        Throws:
        ParseException
      • field

        public final void field​(SDDocumentType document,
                                Search search)
                         throws ParseException
        Consumes a field block from within a document element.
        Parameters:
        document - The document type to modify.
        search - The search object to add content to.
        Throws:
        ParseException
      • annotationOutside

        public final void annotationOutside​(Search search)
                                     throws ParseException
        This rule consumes a annotation block from within either a document element or a search element.
        Parameters:
        search - the search object to add content to.
        Throws:
        ParseException
      • annotation

        public final void annotation​(Search search,
                                     SDDocumentType document)
                              throws ParseException
        This rule consumes a annotation block from within either a document element.
        Parameters:
        document - The document object to add content to.
        Throws:
        ParseException
      • annotationBody

        public final SDAnnotationType annotationBody​(Search search,
                                                     SDAnnotationType type)
                                              throws ParseException
        This rule consumes a single element of an annotation body block.
        Parameters:
        search - The search object to add content to.
        type - The type being built.
        Returns:
        a modified or new AnnotationType instance
        Throws:
        ParseException
      • structInside

        public final void structInside​(SDDocumentType document,
                                       Search search)
                                throws ParseException
        This rule consumes a struct block from within a document element.
        Parameters:
        search - The search object to add content to.
        Throws:
        ParseException
      • structOutside

        public final void structOutside​(Search search)
                                 throws ParseException
        This rule consumes a struct block from within a document element.
        Parameters:
        search - The search object to add content to.
        Throws:
        ParseException
      • dataType

        public final com.yahoo.document.DataType dataType()
                                                   throws ParseException
        This rule consumes a data type block from within a field element.
        Returns:
        The consumed data type.
        Throws:
        ParseException
      • structFieldDefinition

        public final void structFieldDefinition​(SDDocumentType struct)
                                         throws ParseException
        This rule consumes a field block of a struct body.
        Parameters:
        struct - The struct to modify.
        Throws:
        ParseException
      • structField

        public final void structField​(FieldOperationContainer field,
                                      Search search,
                                      SDDocumentType document)
                               throws ParseException
        This rule consumes a struct subfield from a document field body. This is not to be confused with a document struct's fields, but rather this is a subfield of a document field of type struct.
        Parameters:
        field - The field to modify.
        search - The search object to add content to.
        document - The document type to modify.
        Throws:
        ParseException
      • fieldBody

        public final java.lang.String fieldBody​(SDField field,
                                                Search search,
                                                SDDocumentType document)
                                         throws ParseException
        This rule consumes a single element of a field body block.
        Parameters:
        field - The field being built.
        search - The search object to add content to.
        document - The owning document, or null if this is a search field.
        Returns:
        Null.
        Throws:
        ParseException
      • structFieldBody

        public final java.lang.String structFieldBody​(FieldOperationContainer field,
                                                      Search search,
                                                      SDDocumentType document)
                                               throws ParseException
        This rule consumes a single element of a struct subfield body block. Only elements that are supported in streaming search and indexed search (with complex attributes) are allowed.
        Parameters:
        field - The field being built.
        search - The search object to add content to.
        document - The owning document, or null if this is a search field.
        Returns:
        Null.
        Throws:
        ParseException
      • indexingOperation

        public final void indexingOperation​(FieldOperationContainer field,
                                            boolean multiLine)
                                     throws ParseException
        This rule consumes an IL script block. This is expected to consume trailing newlines.
        Parameters:
        field - The field to modify.
        Throws:
        ParseException
      • weightedset

        public final java.lang.Object weightedset​(FieldOperationContainer field)
                                           throws ParseException
        This rule consumes a weighted set statement of a field element.
        Parameters:
        field - The field to modify.
        Returns:
        Null.
        Throws:
        ParseException
      • weightedsetBody

        public final java.lang.Object weightedsetBody​(WeightedSetOperation field)
                                               throws ParseException
        This rule consumes one body item of a weighted set block.
        Parameters:
        field - The field to modify.
        Returns:
        Null.
        Throws:
        ParseException
      • attributeSetting

        public final java.lang.Object attributeSetting​(FieldOperationContainer field,
                                                       AttributeOperation attribute,
                                                       java.lang.String attributeName)
                                                throws ParseException
        This rule consumes a single attribute setting statement of an attribute element.
        Parameters:
        field - The field to modify.
        attributeName - The name of the attribute to change.
        Returns:
        Null.
        Throws:
        ParseException
      • attributeTensorType

        public final java.lang.Object attributeTensorType​(AttributeOperation attribute)
                                                   throws ParseException
        This rule consumes a tensor type statement for an attribute element.
        Parameters:
        attribute - The attribute to modify.
        Returns:
        Null.
        Throws:
        ParseException
      • summaryInDocument

        public final java.lang.Object summaryInDocument​(DocumentSummary document)
                                                 throws ParseException
        This rule consumes a summary statement defined inside a document-summary block.
        Parameters:
        document - The document summary to modify.
        Returns:
        Null.
        Throws:
        ParseException
      • summaryInField

        public final java.lang.Object summaryInField​(FieldOperationContainer field)
                                              throws ParseException
        The rule consumes a summary statement defined inside a field.
        Parameters:
        field - The field to modify.
        Returns:
        Null.
        Throws:
        ParseException
      • summaryTransform

        public final java.lang.Object summaryTransform​(SummaryInFieldOperation field)
                                                throws ParseException
        This rule consumes a transform statement for a summary field element.
        Parameters:
        field - The field to modify.
        Returns:
        Null.
        Throws:
        ParseException
      • summarySourceList

        public final void summarySourceList​(SummaryInFieldOperation field)
                                     throws ParseException
        This rule consumes a source-list statement for a summary field element.
        Parameters:
        field - The summary field to modify.
        Throws:
        ParseException
      • summaryDestinationList

        public final void summaryDestinationList​(SummaryInFieldLongOperation field)
                                          throws ParseException
        This rule consumes a destination-list statement for a summary field element.
        Parameters:
        field - The summary field to modify.
        Throws:
        ParseException
      • searchStemming

        public final void searchStemming​(Search search)
                                  throws ParseException
        This rule consumes a stemming statement for a search element.
        Parameters:
        search - The search to modify.
        Throws:
        ParseException
      • normalizing

        public final void normalizing​(FieldOperationContainer field)
                               throws ParseException
        This rule consumes a normalizing statement of a field element. At the moment, this can only be used to turn off normalizing.
        Parameters:
        field - The field to modify.
        Throws:
        ParseException
      • body

        public final void body​(SDField field)
                        throws ParseException
        This rule consumes a body statement of a field element.
        Parameters:
        field - The field to modify.
        Throws:
        ParseException
      • header

        public final void header​(SDField field)
                          throws ParseException
        This rule consumes a header statement of a field element.
        Parameters:
        field - The field to modify.
        Throws:
        ParseException
      • rankSetting

        public final java.lang.Object rankSetting​(RankOperation field)
                                           throws ParseException
        Consumes a single rank setting of a rank statement.
        Parameters:
        field - The field to modify.
        Returns:
        Null.
        Throws:
        ParseException
      • documentSummary

        public final java.lang.Object documentSummary​(Search search)
                                               throws ParseException
        Consumes a document-summary block from within a search block.
        Parameters:
        search - The search object to add content to.
        Returns:
        Null.
        Throws:
        ParseException
      • inheritsDocumentSummary

        public final void inheritsDocumentSummary​(DocumentSummary documentSummary,
                                                  Search search)
                                           throws ParseException
        This rule consumes an inherits statement of a document summary.
        Parameters:
        documentSummary - The document summary to modify.
        search - The search object documentSummary is being added to.
        Throws:
        ParseException
      • documentSummaryItem

        public final java.lang.Object documentSummaryItem​(DocumentSummary summary)
                                                   throws ParseException
        Consumes a single document-summary item.
        Parameters:
        summary - The document summary to modify.
        Returns:
        Null.
        Throws:
        ParseException
      • index

        public final java.lang.Object index​(Search search,
                                            FieldOperationContainer field)
                                     throws ParseException
        Consumes an index block for a field element.
        Parameters:
        search - The search object to add content to.
        field - The field to modify.
        Returns:
        Null.
        Throws:
        ParseException
      • indexBody

        public final java.lang.Object indexBody​(IndexOperation index)
                                         throws ParseException
        Consumes a single index statement for an index block.
        Parameters:
        index - The index to modify.
        Returns:
        Null.
        Throws:
        ParseException
      • rankingConstant

        public final void rankingConstant​(Search search)
                                   throws ParseException
        Consumes a constant block of a search element.
        Parameters:
        search - The search object to add content to.
        Throws:
        ParseException
      • rankingConstantItem

        public final java.lang.Object rankingConstantItem​(RankingConstant constant)
                                                   throws ParseException
        This rule consumes a constant block.
        Parameters:
        constant - The constant to modify.
        Returns:
        Null.
        Throws:
        ParseException
      • rankingConstantErrorMessage

        public final java.lang.String rankingConstantErrorMessage​(java.lang.String name)
                                                           throws ParseException
        Throws:
        ParseException
      • rankProfile

        public final void rankProfile​(Search search)
                               throws ParseException
        Consumes a rank-profile block of a search element.
        Parameters:
        search - The search object to add content to.
        Throws:
        ParseException
      • rankProfileItem

        public final java.lang.Object rankProfileItem​(RankProfile profile)
                                               throws ParseException
        This rule consumes a single statement for a rank-profile block.
        Parameters:
        profile - The rank profile to modify.
        Returns:
        Null.
        Throws:
        ParseException
      • inheritsRankProfile

        public final void inheritsRankProfile​(RankProfile profile)
                                       throws ParseException
        This rule consumes an inherits statement of a rank-profile.
        Parameters:
        profile - The profile to modify.
        Throws:
        ParseException
      • function

        public final void function​(RankProfile profile)
                            throws ParseException
        This rule consumes a function statement of a rank-profile.
        Parameters:
        profile - The profile to modify.
        Throws:
        ParseException
      • matchPhase

        public final void matchPhase​(RankProfile profile)
                              throws ParseException
        This rule consumes a match-phase block of a rank profile.
        Parameters:
        profile - The rank profile to modify.
        Throws:
        ParseException
      • firstPhase

        public final void firstPhase​(RankProfile profile)
                              throws ParseException
        Consumes the first-phase block of a rank profile.
        Parameters:
        profile - The rank profile to modify.
        Throws:
        ParseException
      • secondPhase

        public final void secondPhase​(RankProfile profile)
                               throws ParseException
        Consumes the second-phase block of a rank profile.
        Parameters:
        profile - The rank profile to modify.
        Throws:
        ParseException
      • secondPhaseItem

        public final java.lang.Object secondPhaseItem​(RankProfile profile)
                                               throws ParseException
        Consumes a statement for a second-phase block.
        Parameters:
        profile - The rank profile to modify.
        Returns:
        Null.
        Throws:
        ParseException
      • summaryFeatures

        public final java.lang.Object summaryFeatures​(RankProfile profile)
                                               throws ParseException
        This rule consumes a summary-features block of a rank profile.
        Parameters:
        profile - The rank profile to modify.
        Returns:
        Null.
        Throws:
        ParseException
      • rankFeatures

        public final java.lang.Object rankFeatures​(RankProfile profile)
                                            throws ParseException
        This rule consumes a rank-features block of a rank profile.
        Parameters:
        profile - The rank profile to modify.
        Returns:
        Null.
        Throws:
        ParseException
      • ignoreRankFeatures

        public final void ignoreRankFeatures​(RankProfile profile)
                                      throws ParseException
        This rule consumes a ignore-default-rank-features statement for a rank profile.
        Parameters:
        profile - The rank profile to modify.
        Throws:
        ParseException
      • numThreadsPerSearch

        public final void numThreadsPerSearch​(RankProfile profile)
                                       throws ParseException
        This rule consumes a num-threads-per-search statement for a rank profile.
        Parameters:
        profile - The rank profile to modify.
        Throws:
        ParseException
      • minHitsPerThread

        public final void minHitsPerThread​(RankProfile profile)
                                    throws ParseException
        This rule consumes a min-hits-per-thread statement for a rank profile.
        Parameters:
        profile - The rank profile to modify.
        Throws:
        ParseException
      • numSearchPartitions

        public final void numSearchPartitions​(RankProfile profile)
                                       throws ParseException
        This rule consumes a num-search-partitions statement for a rank profile.
        Parameters:
        profile - The rank profile to modify.
        Throws:
        ParseException
      • termwiseLimit

        public final void termwiseLimit​(RankProfile profile)
                                 throws ParseException
        This rule consumes a num-threads-per-search statement for a rank profile.
        Parameters:
        profile - The rank profile to modify.
        Throws:
        ParseException
      • rankProperties

        public final void rankProperties​(RankProfile profile)
                                  throws ParseException
        This rule consumes a rank-properties block of a rank profile. There is a little trick within this rule to allow the final rank property to skip the terminating newline token.
        Parameters:
        profile - The rank profile to modify.
        Throws:
        ParseException
      • rankProperty

        public final void rankProperty​(RankProfile profile)
                                throws ParseException
        This rule consumes a single rank property pair for a rank profile.
        Parameters:
        profile - The rank profile to modify.
        Throws:
        ParseException
      • rankPropertyItem

        public final java.lang.String rankPropertyItem()
                                                throws ParseException
        This rule consumes a single rank property for a rank-properties block.
        Returns:
        The token image of the consumed item.
        Throws:
        ParseException
      • fieldWeight

        public final void fieldWeight​(RankProfile profile)
                               throws ParseException
        This rule consumes a field-weight statement of a rank profile.
        Parameters:
        profile - The rank profile to modify.
        Throws:
        ParseException
      • fieldRankType

        public final void fieldRankType​(RankProfile profile)
                                 throws ParseException
        This rule consumes a rank-type statement of a rank profile.
        Parameters:
        profile - The rank profile to modify.
        Throws:
        ParseException
      • fieldRankFilter

        public final void fieldRankFilter​(RankProfile profile)
                                   throws ParseException
        This rule consumes a rank filter statement of a rank profile.
        Parameters:
        profile - The rank profile to modify.
        Throws:
        ParseException
      • rankDegradationBinSize

        public final void rankDegradationBinSize()
                                          throws ParseException
        This rule consumes part of a rank-degradation statement of a rank profile.
        Throws:
        ParseException
      • rankDegradationBinLow

        public final void rankDegradationBinLow()
                                         throws ParseException
        This rule consumes part of a rank-degradation statement of a rank profile.
        Throws:
        ParseException
      • rankDegradationPosbinSize

        public final void rankDegradationPosbinSize()
                                             throws ParseException
        This rule consumes part of a rank-degradation statement of a rank profile.
        Throws:
        ParseException
      • rankDegradationItem

        public final java.lang.Object rankDegradationItem()
                                                   throws ParseException
        This rule consumes part of a rank-degradation statement of a rank profile.
        Throws:
        ParseException
      • rankDegradation

        public final java.lang.Object rankDegradation​(RankProfile profile)
                                               throws ParseException
        This rule consumes a rank-degradation statement of a rank profile.
        Parameters:
        profile - The rank profile to modify.
        Throws:
        ParseException
      • constants

        public final void constants​(RankProfile profile)
                             throws ParseException
        Consumes a set of constants available in ranking expressions in the enclosing profile.
        Throws:
        ParseException
      • constantTensorErrorMessage

        public final java.lang.String constantTensorErrorMessage​(java.lang.String rankProfileName,
                                                                 java.lang.String constantTensorName)
                                                          throws ParseException
        Throws:
        ParseException
      • tensorTypeWithPrefix

        public final com.yahoo.tensor.TensorType tensorTypeWithPrefix​(java.lang.String errorMessage)
                                                               throws ParseException
        Throws:
        ParseException
      • tensorType

        public final com.yahoo.tensor.TensorType tensorType​(java.lang.String errorMessage)
                                                     throws ParseException
        Throws:
        ParseException
      • expression

        public final java.lang.String expression()
                                          throws ParseException
        This rule consumes an expression token and returns its image.
        Returns:
        The consumed token image.
        Throws:
        ParseException
      • identifier

        public final java.lang.String identifier()
                                          throws ParseException
        This rule consumes an identifier. This must be kept in sync with all word tokens that should be parseable as identifiers.
        Returns:
        The identifier string.
        Throws:
        ParseException
      • string

        public final java.lang.String string()
                                      throws ParseException
        This rule consumes a string token and returns the token image.
        Returns:
        The consumed token image.
        Throws:
        ParseException
      • quotedString

        public final java.lang.String quotedString()
                                            throws ParseException
        This rule consumes a quoted string token and returns the token image minus the quotes. This does not perform unescaping of the content, it simply removes the first and last character of the image. However, the token itself can contain anything but a double quote.
        Returns:
        The unquoted token image.
        Throws:
        ParseException
      • bool

        public final java.lang.Boolean bool()
                                     throws ParseException
        This rule consumes a boolean value.
        Returns:
        The consumed boolean value.
        Throws:
        ParseException
      • integer

        public final int integer()
                          throws ParseException
        This rule consumes an integer token and returns its numeric value.
        Returns:
        The consumed integer value.
        Throws:
        ParseException
      • consumeLong

        public final long consumeLong()
                               throws ParseException
        This rule consumes a long or integer token and returns its numeric value.
        Returns:
        The consumed long value.
        Throws:
        ParseException
      • consumeFloat

        public final double consumeFloat()
                                  throws ParseException
        This rule consumes a floating-point token and returns its numeric value.
        Returns:
        The consumed value.
        Throws:
        ParseException
      • lbrace

        public final void lbrace()
                          throws ParseException
        This rule consumes an opening brace with leading and trailing newline tokens.
        Throws:
        ParseException
      • ReInit

        public void ReInit​(CharStream stream)
        Reinitialise.
        Parameters:
        stream - stream to init with
      • ReInit

        public void ReInit​(SDParserTokenManager tm)
        Reinitialise
        Parameters:
        tm - Token manager to use
      • getNextToken

        public final Token getNextToken()
        Returns:
        the next Token.
      • getToken

        public final Token getToken​(int index)
        Parameters:
        index - index to be retrieved
        Returns:
        the specific Token.
      • generateParseException

        public ParseException generateParseException()
        Generate ParseException.
        Returns:
        new Exception object. Never null
      • trace_enabled

        public final boolean trace_enabled()
        Returns:
        Always false.
      • enable_tracing

        public final void enable_tracing()
        Enable tracing.
      • disable_tracing

        public final void disable_tracing()
        Disable tracing.