| java.lang.Object org.apache.solr.search.QueryParsing
QueryParsing | public class QueryParsing (Code) | | Collection of static utilities usefull for query parsing.
author: yonik version: $Id: QueryParsing.java 542679 2007-05-29 22:28:21Z ryan $ |
Inner Class :public static class SortSpec | |
Field Summary | |
final public static String | OP |
Method Summary | |
public static FunctionQuery | parseFunction(String func, IndexSchema schema) Parse a function, returning a FunctionQuery
Syntax Examples.... | public static Query | parseQuery(String qs, IndexSchema schema) Helper utility for parsing a query using the Lucene QueryParser syntax. | public static Query | parseQuery(String qs, String defaultField, IndexSchema schema) Helper utility for parsing a query using the Lucene QueryParser syntax. | public static Query | parseQuery(String qs, String defaultField, SolrParams params, IndexSchema schema) Helper utility for parsing a query using the Lucene QueryParser syntax. | public static SortSpec | parseSort(String sortSpec, IndexSchema schema) Returns null if the sortSpec is the standard sort desc. | public static void | toString(Query query, IndexSchema schema, Appendable out, int flags) | public static String | toString(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.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. | public static List<String> | toString(List<Query> queries, IndexSchema schema) | static FieldType | writeFieldName(String name, IndexSchema schema, Appendable out, int flags) | static void | writeFieldVal(String val, FieldType ft, Appendable out, int flags) |
OP | final public static String OP(Code) | | the SolrParam used to override the QueryParser "default operator"
|
parseFunction | public static FunctionQuery parseFunction(String func, IndexSchema schema) throws ParseException(Code) | | Parse a function, returning a FunctionQuery
Syntax Examples....
// Numeric fields default to correct type
// (ie: IntFieldSource or FloatFieldSource)
// Others use implicit ord(...) to generate numeric field value
myfield
// OrdFieldSource
ord(myfield)
// ReverseOrdFieldSource
rord(myfield)
// LinearFloatFunction on numeric field value
linear(myfield,1,2)
// MaxFloatFunction of LinearFloatFunction on numeric field value or constant
max(linear(myfield,1,2),100)
// ReciprocalFloatFunction on numeric field value
recip(myfield,1,2,3)
// ReciprocalFloatFunction on ReverseOrdFieldSource
recip(rord(myfield),1,2,3)
// ReciprocalFloatFunction on LinearFloatFunction on ReverseOrdFieldSource
recip(linear(rord(myfield),1,2),3,4,5)
|
parseQuery | public static Query parseQuery(String qs, IndexSchema schema)(Code) | | Helper utility for parsing a query using the Lucene QueryParser syntax.
Parameters: qs - query expression in standard Lucene syntax Parameters: schema - used for default operator (overridden by params) and passed to the query parser for field format analysis information |
parseQuery | public static Query parseQuery(String qs, String defaultField, IndexSchema schema)(Code) | | Helper utility for parsing a query using the Lucene QueryParser syntax.
Parameters: qs - query expression in standard Lucene syntax Parameters: defaultField - default field used for unqualified search terms in the query expression Parameters: schema - used for default operator (overridden by params) and passed to the query parser for field format analysis information |
parseQuery | public static Query parseQuery(String qs, String defaultField, SolrParams params, IndexSchema schema)(Code) | | Helper utility for parsing a query using the Lucene QueryParser syntax.
Parameters: qs - query expression in standard Lucene syntax Parameters: defaultField - default field used for unqualified search terms in the query expression Parameters: params - used to determine the default operator, overriding the schema specified operator Parameters: schema - used for default operator (overridden by params) and passed to the query parser for field format analysis information |
parseSort | public static SortSpec parseSort(String sortSpec, IndexSchema schema)(Code) | | Returns null if the sortSpec is the standard sort desc.
The form of the sort specification string currently parsed is:
>
SortSpec ::= SingleSort [, SingleSort]*
SingleSort ::= SortDirection
SortDirection ::= top | desc | bottom | asc
Examples:
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
|
toString | public static String toString(Query query, IndexSchema schema)(Code) | | Formats a Query for debugging, using the IndexSchema to make
complex field types readable.
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.
|
toString | public static List<String> toString(List<Query> queries, IndexSchema schema)(Code) | | Builds a list of String which are stringified versions of a list of Queries
|
|
|