Python 2.7 has reached end of support and will be deprecated on January 31, 2026. After deprecation, you won't be able to deploy Python 2.7 applications, even if your organization previously used an organization policy to re-enable deployments of legacy runtimes. Your existing Python 2.7 applications will continue to run and receive traffic after their deprecation date. We recommend that you migrate to the latest supported version of Python.

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

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025年06月16日 UTC.