Package org.apache.solr.search
Class QueryParsing
java.lang.Object
org.apache.solr.search.QueryParsing
Collection of static utilities useful for query parsing.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic org.apache.solr.common.params.SolrParamsgetLocalParams(String txt, org.apache.solr.common.params.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, org.apache.solr.common.params.ModifiableSolrParams target, org.apache.solr.common.params.SolrParams params) static intparseLocalParams(String txt, int start, org.apache.solr.common.params.ModifiableSolrParams target, org.apache.solr.common.params.SolrParams params, String startString, char endChar) static QueryParser.OperatorParses default operator string into Operator objecttoString(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 Details
-
OP
- See Also:
-
V
- See Also:
-
F
- See Also:
-
TYPE
- See Also:
-
DEFTYPE
- See Also:
-
SPLIT_ON_WHITESPACE
- See Also:
-
LOCALPARAM_START
- See Also:
-
LOCALPARAM_END
public static final char LOCALPARAM_END- See Also:
-
VAL_EXPLICIT
- See Also:
-
-
Constructor Details
-
QueryParsing
public QueryParsing()
-
-
Method Details
-
parseLocalParams
public static int parseLocalParams(String txt, int start, org.apache.solr.common.params.ModifiableSolrParams target, org.apache.solr.common.params.SolrParams params) throws SyntaxError - Parameters:
txt- Text to parsestart- Index into text for start of parsingtarget- Object to inject with parsed settingsparams- Additional existing parameters- Throws:
SyntaxError
-
parseLocalParams
public static int parseLocalParams(String txt, int start, org.apache.solr.common.params.ModifiableSolrParams target, org.apache.solr.common.params.SolrParams params, String startString, char endChar) throws SyntaxError - Parameters:
txt- Text to parsestart- Index into text for start of parsingtarget- Object to inject with parsed settingsparams- Additional existing parametersstartString- String that indicates the start of a localParams sectionendChar- Character that indicates the end of a localParams section- Throws:
SyntaxError
-
getLocalParams
public static org.apache.solr.common.params.SolrParams getLocalParams(String txt, org.apache.solr.common.params.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
-
toString
public static void toString(org.apache.lucene.search.Query query, IndexSchema schema, Appendable out, int flags) throws IOException - Throws:
IOException- See Also:
-
toString
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. -
toString
public 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 -
parseOP
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)
-