|
SMILA 1.0 API documentation | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.eclipse.smila.solr.util.SolrQueryUtils
public final class SolrQueryUtils
Provide extensions/simplifications for handling SolrQuery.
| Field Summary | |
|---|---|
static java.lang.String |
ESCAPE_CHARS
chars, that if part of a term need to be escaped when searching. |
static java.lang.String |
ESCAPE_CHARS_WS
chars, that if part of a term need to be escaped when searching. including space |
static java.lang.String |
OR_SEPARATOR
Lucene/Solr operator for OR query parts. |
static java.lang.String |
QUERY_WRAPPER_FILTER
The query wrapper filter string. |
| Method Summary | |
|---|---|
static void |
appendFieldQueryPart(java.lang.StringBuilder q,
java.lang.String field,
java.util.List<Value> values)
|
static java.lang.String |
decodeQuery(java.lang.String query)
|
static java.lang.String |
encodeQuery(java.lang.String query)
Encode a query into application/x-www-form-urlencoded format. |
static java.lang.String |
escapeQuery(java.lang.String query)
Escapes all chars with a special meaning to the lucene query parser. |
static java.lang.String |
escapeQuery(java.lang.String query,
java.lang.String escapeChars)
Escapes the given chars in the given query by prepending '\'. |
static boolean |
responseStatusIsError(SolrResponseBase response)
returns true if response indicates an error. |
static java.lang.String |
toConstQueryOnField(java.lang.String fieldName,
java.lang.String constant)
creates a query string on the given field for a constant which must be searched "as is", i.e. escaping fo chars and wrapping in quotes |
static java.lang.String |
toSolrQueryFilter(java.lang.String filter)
Convert a lucene QueryWrapperFilter to a query filter for solr. |
static java.lang.String |
toTokenQueryOnField(java.lang.String fieldName,
java.lang.String token)
returns an escaped query string of the form (<field>:<token>). |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String OR_SEPARATOR
public static final java.lang.String QUERY_WRAPPER_FILTER
public static final java.lang.String ESCAPE_CHARS
public static final java.lang.String ESCAPE_CHARS_WS
| Method Detail |
|---|
public static void appendFieldQueryPart(java.lang.StringBuilder q,
java.lang.String field,
java.util.List<Value> values)
q - the query to add the field query part to.field - the field name to add the query part forvalues - the field value alternatives to match in the search
public static java.lang.String encodeQuery(java.lang.String query)
throws java.io.UnsupportedEncodingException
query - the query.
java.io.UnsupportedEncodingException - UnsupportedEncodingException.
public static java.lang.String decodeQuery(java.lang.String query)
throws java.io.UnsupportedEncodingException
java.io.UnsupportedEncodingExceptionpublic static java.lang.String escapeQuery(java.lang.String query)
query - the query.
ESCAPE_CHARS,
toConstQueryOnField(String, String)
public static java.lang.String escapeQuery(java.lang.String query,
java.lang.String escapeChars)
query - the query, if empty nothing happens and it is returned as is.escapeChars - the chars to escape
public static boolean responseStatusIsError(SolrResponseBase response)
throws SolrServerException
SolrServerExceptionhttp://lucene.472066.n3.nabble.com/Response-status-td490876.htmlpublic static java.lang.String toSolrQueryFilter(java.lang.String filter)
filter - the filter.
public static java.lang.String toConstQueryOnField(java.lang.String fieldName,
java.lang.String constant)
fieldName - must not contain whitespace, but this is not checked!constant - the constant
public static java.lang.String toTokenQueryOnField(java.lang.String fieldName,
java.lang.String token)
(<field>:<token>). The given token is fully escaped, i.e.
including spaces.
|
SMILA 1.0 API documentation | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||