Package org.apache.solr.search
Class QueryParsing
- java.lang.Object
- 
- org.apache.solr.search.QueryParsing
 
- 
 public class QueryParsing extends Object Collection of static utilities useful for query parsing.
- 
- 
Field SummaryFields Modifier and Type Field Description static StringDEFTYPEstatic StringFstatic charLOCALPARAM_ENDstatic StringLOCALPARAM_STARTstatic StringOPstatic StringSPLIT_ON_WHITESPACEstatic StringTYPEstatic StringVstatic StringVAL_EXPLICIT
 - 
Constructor SummaryConstructors Constructor Description QueryParsing()
 - 
Method SummaryAll Methods Static Methods Concrete Methods Modifier and Type Method Description static SolrParamsgetLocalParams(String txt, SolrParams params)"foo" returns null "{!prefix f=myfield}yes" returns type="prefix",f="myfield",v="yes" "{!prefix f=myfield v=$p}" returns type="prefix",f="myfield",v=params.get("p")static intparseLocalParams(String txt, int start, ModifiableSolrParams target, SolrParams params)static intparseLocalParams(String txt, int start, ModifiableSolrParams target, SolrParams params, String startString, char endChar)static QueryParser.OperatorparseOP(String operator)Parses default operator string into Operator objectstatic List<String>toString(List<org.apache.lucene.search.Query> queries, IndexSchema schema)Builds a list of String which are stringified versions of a list of Queriesstatic StringtoString(org.apache.lucene.search.Query query, IndexSchema schema)Formats a Query for debugging, using the IndexSchema to make complex field types readable.static voidtoString(org.apache.lucene.search.Query query, IndexSchema schema, Appendable out, int flags)
 
- 
- 
- 
Field Detail- 
OPpublic static final String OP - See Also:
- Constant Field Values
 
 - 
Vpublic static final String V - See Also:
- Constant Field Values
 
 - 
Fpublic static final String F - See Also:
- Constant Field Values
 
 - 
TYPEpublic static final String TYPE - See Also:
- Constant Field Values
 
 - 
DEFTYPEpublic static final String DEFTYPE - See Also:
- Constant Field Values
 
 - 
SPLIT_ON_WHITESPACEpublic static final String SPLIT_ON_WHITESPACE - See Also:
- Constant Field Values
 
 - 
LOCALPARAM_STARTpublic static final String LOCALPARAM_START - See Also:
- Constant Field Values
 
 - 
LOCALPARAM_ENDpublic static final char LOCALPARAM_END - See Also:
- Constant Field Values
 
 - 
VAL_EXPLICITpublic static final String VAL_EXPLICIT - See Also:
- Constant Field Values
 
 
- 
 - 
Method Detail- 
parseLocalParamspublic static int parseLocalParams(String txt, int start, ModifiableSolrParams target, SolrParams params) throws SyntaxError - Parameters:
- txt- Text to parse
- start- Index into text for start of parsing
- target- Object to inject with parsed settings
- params- Additional existing parameters
- Throws:
- SyntaxError
 
 - 
parseLocalParamspublic static int parseLocalParams(String txt, int start, ModifiableSolrParams target, SolrParams params, String startString, char endChar) throws SyntaxError - Parameters:
- txt- Text to parse
- start- Index into text for start of parsing
- target- Object to inject with parsed settings
- params- Additional existing parameters
- startString- String that indicates the start of a localParams section
- endChar- Character that indicates the end of a localParams section
- Throws:
- SyntaxError
 
 - 
getLocalParamspublic static SolrParams getLocalParams(String txt, SolrParams params) throws SyntaxError "foo" returns null "{!prefix f=myfield}yes" returns type="prefix",f="myfield",v="yes" "{!prefix f=myfield v=$p}" returns type="prefix",f="myfield",v=params.get("p")- Throws:
- SyntaxError
 
 - 
toStringpublic static void toString(org.apache.lucene.search.Query query, IndexSchema schema, Appendable out, int flags) throws IOException- Throws:
- IOException
- See Also:
- toString(Query,IndexSchema)
 
 - 
toStringpublic static String toString(org.apache.lucene.search.Query query, IndexSchema schema) Formats a Query for debugging, using the IndexSchema to make complex field types readable.The benefit of using this method instead of calling Query.toStringdirectly is that it knows about the data types of each field, so any field which is encoded in a particularly complex way is still readable. The downside is that it only knows about built in Query types, and will not be able to format custom Query classes.
 - 
toStringpublic static List<String> toString(List<org.apache.lucene.search.Query> queries, IndexSchema schema) Builds a list of String which are stringified versions of a list of Queries
 - 
parseOPpublic static QueryParser.Operator parseOP(String operator) Parses default operator string into Operator object- Parameters:
- operator- the string from request
- Returns:
- Operator.AND if string equals "AND", else return Operator.OR (default)
 
 
- 
 
-