Package org.mycore.services.fieldquery
Class MCRQueryParser
Parses query conditions for use in MCRSearcher.
- Author:
- Frank Lützenkirchen
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic MCRCondition<Void>
normalizeCondition
(MCRCondition<Void> cond) Normalizes a parsed query condition.Parse a complex or simple condition in String format and put it in an condition object.Parse a complex or simple condition in XML format and put it in an condition object.protected MCRCondition<Void>
Parses a String containing a simple query condition, for example: (title contains "Java") and (creatorID = "122132131")protected MCRCondition<Void>
Parses XML element containing a simple query conditionstatic boolean
validateQueryExpression
(String query) Used for input validation in editor search formMethods inherited from class org.mycore.parsers.bool.MCRBooleanClauseParser
defaultRule
-
Constructor Details
-
MCRQueryParser
public MCRQueryParser()
-
-
Method Details
-
parseSimpleCondition
Parses XML element containing a simple query condition- Overrides:
parseSimpleCondition
in classMCRBooleanClauseParser<Void>
- Parameters:
e
- the 'condition' element- Returns:
- the parsed MCRQueryCondition object
- Throws:
MCRParseException
-
parseSimpleCondition
Parses a String containing a simple query condition, for example: (title contains "Java") and (creatorID = "122132131")- Overrides:
parseSimpleCondition
in classMCRBooleanClauseParser<Void>
- Parameters:
s
- the condition as a String- Returns:
- the parsed MCRQueryCondition object
- Throws:
MCRParseException
-
parse
Description copied from class:MCRBooleanClauseParser
Parse a complex or simple condition in XML format and put it in an condition object.- Overrides:
parse
in classMCRBooleanClauseParser<Void>
- Parameters:
condition
- a MyCoRe condition object in XML format- Returns:
- a MyCoRe condition object in the MCRCondition format
- Throws:
MCRParseException
-
parse
Description copied from class:MCRBooleanClauseParser
Parse a complex or simple condition in String format and put it in an condition object.- Overrides:
parse
in classMCRBooleanClauseParser<Void>
- Parameters:
s
- a MyCoRe condition object in String format- Returns:
- a MyCoRe condition object in the MCRCondition format
- Throws:
MCRParseException
-
normalizeCondition
Normalizes a parsed query condition. AND/OR conditions that just have one child will be replaced with that child. NOT(NOT(X)) will be normalized to X. (A AND (b AND c)) will be normalized to (A AND B AND C), same for nested ORs. AND/OR/NOT conditions with no child conditions will be removed. Conditions that use the operator "contains" will be splitted into multiple simpler conditions if the condition value contains phrases surrounded by '...' or wildcard search with * or ?. -
validateQueryExpression
Used for input validation in editor search form
-