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.
Stay organized with collections
Save and categorize content based on your preferences.
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.
Parametersmsg – the error message
RaisesQueryException – 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.
Parametersmsg – the error message
RaisesQueryException – 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.
Parametersnode – Root of the tree to transform.
ReturnsA 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.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-06-16 UTC."],[[["\u003cp\u003eThis module provides a wrapper for QueryParser, enabling the parsing and manipulation of search queries.\u003c/p\u003e\n"],["\u003cp\u003eIt offers functions to create, parse, and simplify queries, including the conversion of nodes between different types.\u003c/p\u003e\n"],["\u003cp\u003eThe module includes methods to extract text from query nodes, handling both standard and Unicode text.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eQueryLexerWithErrors\u003c/code\u003e and \u003ccode\u003eQueryParserWithErrors\u003c/code\u003e classes are implemented to raise exceptions when parsing errors occur, providing error messages for failed parsing.\u003c/p\u003e\n"],["\u003cp\u003eIt also handles the simplification of the query tree by converting SEQUENCE nodes into CONJUNCTION nodes, and removing surrounding quotation marks from text.\u003c/p\u003e\n"]]],[],null,["# google.appengine.api.search.query_parser module\n===============================================\n\nSummary\n-------\n\nWrapper for QueryParser.\n\nContents\n--------\n\ngoogle.appengine.api.search.query_parser.ConvertNodes(node, from_type, to_type, to_text)[source](/appengine/docs/legacy/standard/python/refdocs/modules/google/appengine/api/search/query_parser#ConvertNodes)\n\n: Converts nodes of type from_type to nodes of type to_type.\n\ngoogle.appengine.api.search.query_parser.CreateParser(query)[source](/appengine/docs/legacy/standard/python/refdocs/modules/google/appengine/api/search/query_parser#CreateParser)\n\n: Creates a Query Parser.\n\ngoogle.appengine.api.search.query_parser.CreateQueryNode(text, type)[source](/appengine/docs/legacy/standard/python/refdocs/modules/google/appengine/api/search/query_parser#CreateQueryNode)\n: \n\ngoogle.appengine.api.search.query_parser.GetPhraseQueryNodeText(node)[source](/appengine/docs/legacy/standard/python/refdocs/modules/google/appengine/api/search/query_parser#GetPhraseQueryNodeText)\n\n: Returns the text from a query node.\n\ngoogle.appengine.api.search.query_parser.GetQueryNodeText(node)[source](/appengine/docs/legacy/standard/python/refdocs/modules/google/appengine/api/search/query_parser#GetQueryNodeText)\n\n: Returns the text from the node, handling that it could be unicode.\n\ngoogle.appengine.api.search.query_parser.GetQueryNodeTextUnicode(node)[source](/appengine/docs/legacy/standard/python/refdocs/modules/google/appengine/api/search/query_parser#GetQueryNodeTextUnicode)\n\n: Returns the unicode text from node.\n\ngoogle.appengine.api.search.query_parser.IsPhrase(node)[source](/appengine/docs/legacy/standard/python/refdocs/modules/google/appengine/api/search/query_parser#IsPhrase)\n\n: Return true if node is the root of a text phrase.\n\ngoogle.appengine.api.search.query_parser.Parse(query)[source](/appengine/docs/legacy/standard/python/refdocs/modules/google/appengine/api/search/query_parser#Parse)\n\n: Parses a query and returns an ANTLR tree.\n\ngoogle.appengine.api.search.query_parser.ParseAndSimplify(query)[source](/appengine/docs/legacy/standard/python/refdocs/modules/google/appengine/api/search/query_parser#ParseAndSimplify)\n\n: Parses a query and performs all necessary transformations on the tree.\n\n*exception* google.appengine.api.search.query_parser.QueryException[source](/appengine/docs/legacy/standard/python/refdocs/modules/google/appengine/api/search/query_parser#QueryException)\n\n: Bases: exceptions.Exception\n\nAn error occurred while parsing the query input string. \n\n*class* google.appengine.api.search.query_parser.QueryLexerWithErrors(input=None, state=None)[source](/appengine/docs/legacy/standard/python/refdocs/modules/google/appengine/api/search/query_parser#QueryLexerWithErrors)\n\n: Bases: google.appengine.api.search.QueryLexer.QueryLexer\n\n An overridden Lexer that raises exceptions. \n\n displayRecognitionError(tokenNames, e)[source](/appengine/docs/legacy/standard/python/refdocs/modules/google/appengine/api/search/query_parser#QueryLexerWithErrors.displayRecognitionError)\n : \n\n emitErrorMessage(msg)[source](/appengine/docs/legacy/standard/python/refdocs/modules/google/appengine/api/search/query_parser#QueryLexerWithErrors.emitErrorMessage)\n\n : Raise an exception if the input fails to parse correctly.\n\n Overriding the default, which normally just prints a message to\n stderr.\n Parameters\n\n msg -- the error message\n Raises\n\n[QueryException](#google.appengine.api.search.query_parser.QueryException) -- always. \n\n*class* google.appengine.api.search.query_parser.QueryParserWithErrors(input, state=None)[source](/appengine/docs/legacy/standard/python/refdocs/modules/google/appengine/api/search/query_parser#QueryParserWithErrors)\n\n: Bases: google.appengine.api.search.QueryParser.QueryParser\n\n An overridden Parser that raises exceptions. \n\n displayRecognitionError(tokenNames, e)[source](/appengine/docs/legacy/standard/python/refdocs/modules/google/appengine/api/search/query_parser#QueryParserWithErrors.displayRecognitionError)\n : \n\n emitErrorMessage(msg)[source](/appengine/docs/legacy/standard/python/refdocs/modules/google/appengine/api/search/query_parser#QueryParserWithErrors.emitErrorMessage)\n\n : Raise an exception if the input fails to parse correctly.\n\n Overriding the default, which normally just prints a message to\n stderr.\n Parameters\n\n msg -- the error message\n Raises\n\n[QueryException](#google.appengine.api.search.query_parser.QueryException) -- always. \n\n*exception* google.appengine.api.search.query_parser.QueryTreeException(msg, position)[source](/appengine/docs/legacy/standard/python/refdocs/modules/google/appengine/api/search/query_parser#QueryTreeException)\n\n: Bases: exceptions.Exception\n\nAn error occurred while analyzing the parse tree. \n\ngoogle.appengine.api.search.query_parser.RemoveSurroundingQuotes(text)[source](/appengine/docs/legacy/standard/python/refdocs/modules/google/appengine/api/search/query_parser#RemoveSurroundingQuotes)\n\n: Removes outer quotation marks, if present.\n\ngoogle.appengine.api.search.query_parser.SequenceToConjunction(node)[source](/appengine/docs/legacy/standard/python/refdocs/modules/google/appengine/api/search/query_parser#SequenceToConjunction)\n\n: Transform all SEQUENCE nodes into CONJUNCTION nodes.\n\n Sequences have the same semantic meaning as conjunctions, so we transform them\n to conjunctions to make query matching code simpler.\n Parameters\n\n node -- Root of the tree to transform.\n Returns\n\nA tree with all SEQUENCE nodes replaced with CONJUNCTION nodes. \n\ngoogle.appengine.api.search.query_parser.Simplify(parser_return)[source](/appengine/docs/legacy/standard/python/refdocs/modules/google/appengine/api/search/query_parser#Simplify)\n\n: Simplifies the output of the parser.\n\ngoogle.appengine.api.search.query_parser.SimplifyNode(node, restriction=None)[source](/appengine/docs/legacy/standard/python/refdocs/modules/google/appengine/api/search/query_parser#SimplifyNode)\n: \n\ngoogle.appengine.api.search.query_parser.ValidateNode(node)[source](/appengine/docs/legacy/standard/python/refdocs/modules/google/appengine/api/search/query_parser#ValidateNode)\n:"]]