Notice: Over the next few months, we're reorganizing the App Engine documentation site to make it easier to find content and better align with the rest of Google Cloud products. The same content will be available, but the navigation will now match the rest of the Cloud products.

Python 2 is no longer supported by the community. We recommend that you migrate Python 2 apps to Python 3.

google.appengine.api.search.query_parser module

Summary

Wrapper for QueryParser.

Contents

google.appengine.api.search.query_parser.ConvertNodes(node, from_type, to_type, to_text)source

Converts nodes of type from_type to nodes of type to_type.

google.appengine.api.search.query_parser.CreateParser(query)source

Creates a Query Parser.

google.appengine.api.search.query_parser.CreateQueryNode(text, type)source
google.appengine.api.search.query_parser.GetPhraseQueryNodeText(node)source

Returns the text from a query node.

google.appengine.api.search.query_parser.GetQueryNodeText(node)source

Returns the text from the node, handling that it could be unicode.

google.appengine.api.search.query_parser.GetQueryNodeTextUnicode(node)source

Returns the unicode text from node.

google.appengine.api.search.query_parser.IsPhrase(node)source

Return true if node is the root of a text phrase.

google.appengine.api.search.query_parser.Parse(query)source

Parses a query and returns an ANTLR tree.

google.appengine.api.search.query_parser.ParseAndSimplify(query)source

Parses a query and performs all necessary transformations on the tree.

exception google.appengine.api.search.query_parser.QueryExceptionsource

Bases: exceptions.Exception

An error occurred while parsing the query input string.

class google.appengine.api.search.query_parser.QueryLexerWithErrors(input=None, state=None)source

Bases: google.appengine.api.search.QueryLexer.QueryLexer

An overridden Lexer that raises exceptions.

displayRecognitionError(tokenNames, e)source
emitErrorMessage(msg)source

Raise an exception if the input fails to parse correctly.

Overriding the default, which normally just prints a message to stderr.

Parameters

msg – the error message

Raises

QueryException – always.

class google.appengine.api.search.query_parser.QueryParserWithErrors(input, state=None)source

Bases: google.appengine.api.search.QueryParser.QueryParser

An overridden Parser that raises exceptions.

displayRecognitionError(tokenNames, e)source
emitErrorMessage(msg)source

Raise an exception if the input fails to parse correctly.

Overriding the default, which normally just prints a message to stderr.

Parameters

msg – the error message

Raises

QueryException – always.

exception google.appengine.api.search.query_parser.QueryTreeException(msg, position)source

Bases: exceptions.Exception

An error occurred while analyzing the parse tree.

google.appengine.api.search.query_parser.RemoveSurroundingQuotes(text)source

Removes outer quotation marks, if present.

google.appengine.api.search.query_parser.SequenceToConjunction(node)source

Transform all SEQUENCE nodes into CONJUNCTION nodes.

Sequences have the same semantic meaning as conjunctions, so we transform them to conjunctions to make query matching code simpler.

Parameters

node – Root of the tree to transform.

Returns

A tree with all SEQUENCE nodes replaced with CONJUNCTION nodes.

google.appengine.api.search.query_parser.Simplify(parser_return)source

Simplifies the output of the parser.

google.appengine.api.search.query_parser.SimplifyNode(node, restriction=None)source
google.appengine.api.search.query_parser.ValidateNode(node)source