public class QueryParsing extends Object
Modifier and Type | Class and Description |
---|---|
static class |
QueryParsing.StrParser
Simple class to help with parsing a string.
|
Modifier and Type | Field and Description |
---|---|
static String |
DEFTYPE |
static String |
DOCID |
static String |
F |
static char |
LOCALPARAM_END |
static String |
LOCALPARAM_START |
static String |
OP |
static String |
SCORE |
static String |
TYPE |
static String |
V |
static String |
VAL_EXPLICIT |
Constructor and Description |
---|
QueryParsing() |
Modifier and Type | Method and Description |
---|---|
static String |
encodeLocalParamVal(String val) |
static String |
getDefaultField(IndexSchema s,
String df)
Returns the effective default field based on the 'df' param or
hardcoded schema default.
|
static SolrParams |
getLocalParams(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 QueryParser.Operator |
getQueryParserDefaultOperator(IndexSchema sch,
String override)
Returns the "preferred" default operator for use by Query Parsers,
based on the settings in the IndexSchema which may be overridden using
an optional String override value.
|
static int |
parseLocalParams(String txt,
int start,
Map<String,String> target,
SolrParams params) |
static int |
parseLocalParams(String txt,
int start,
Map<String,String> target,
SolrParams params,
String startString,
char endChar) |
static SortSpec |
parseSortSpec(String sortSpec,
SolrQueryRequest req)
The form of the sort specification string currently parsed is:
|
static List<String> |
toString(List<Query> queries,
IndexSchema schema)
Builds a list of String which are stringified versions of a list of Queries
|
static String |
toString(Query query,
IndexSchema schema)
Formats a Query for debugging, using the IndexSchema to make
complex field types readable.
|
static void |
toString(Query query,
IndexSchema schema,
Appendable out,
int flags) |
public static final String OP
public static final String V
public static final String F
public static final String TYPE
public static final String DEFTYPE
public static final String LOCALPARAM_START
public static final char LOCALPARAM_END
public static final String DOCID
public static final String SCORE
public static final String VAL_EXPLICIT
public static QueryParser.Operator getQueryParserDefaultOperator(IndexSchema sch, String override)
public static String getDefaultField(IndexSchema s, String df)
public static int parseLocalParams(String txt, int start, Map<String,String> target, SolrParams params) throws SyntaxError
SyntaxError
public static int parseLocalParams(String txt, int start, Map<String,String> target, SolrParams params, String startString, char endChar) throws SyntaxError
SyntaxError
public static SolrParams getLocalParams(String txt, SolrParams params) throws SyntaxError
SyntaxError
public static SortSpec parseSortSpec(String sortSpec, SolrQueryRequest req)
The form of the sort specification string currently parsed is:
SortSpec ::= SingleSort [, SingleSort]* SingleSort ::= <fieldname|function> SortDirection SortDirection ::= top | desc | bottom | ascExamples:
score desc #normal sort by score (will return null) weight bottom #sort by weight ascending weight desc #sort by weight descending height desc,weight desc #sort by height descending, and use weight descending to break any ties height desc,weight asc #sort by height descending, using weight ascending as a tiebreaker
public static void toString(Query query, IndexSchema schema, Appendable out, int flags) throws IOException
IOException
toString(Query,IndexSchema)
public static String toString(Query query, IndexSchema schema)
The benefit of using this method instead of calling
Query.toString
directly 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.
public static List<String> toString(List<Query> queries, IndexSchema schema)
Copyright © 2000-2015 Apache Software Foundation. All Rights Reserved.