Package org.apache.solr.common.params
Class SolrParams
java.lang.Object
org.apache.solr.common.params.SolrParams
- All Implemented Interfaces:
Serializable,Iterable<Map.Entry<String,,String[]>> MapSerializable,MapWriter,NavigableObject,org.noggit.JSONWriter.Writable
- Direct Known Subclasses:
DefaultSolrParams,MapSolrParams,ModifiableSolrParams,MultiMapSolrParams,RequiredSolrParams
public abstract class SolrParams
extends Object
implements Serializable, MapWriter, Iterable<Map.Entry<String,String[]>>
SolrParams is designed to hold parameters to Solr, often from the request coming into Solr. It's
basically a MultiMap of String keys to one or more String values. Neither keys nor values may be
null. Unlike a general Map/MultiMap, the size is unknown without iterating over each parameter
name, if you want to count the different values for a key separately.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.solr.common.MapWriter
MapWriter.EntryWriter -
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanA SolrParams is equal to another if they have the same keys and values.protected Stringabstract StringReturns the first String value of a param, or null if not set.returns the value of the param, or def if not setReturns the Boolean value of the param, or null if not set.booleanReturns the boolean value of the param, or def if not setReturns the Float value of the param, or null if not set Use this method only when you want to be explicit about absence of a value (null) vs the default value zero (0.0d).doubleReturns the float value of the param, or def if not setgetFieldBool(String field, String param) Returns the Boolean value of the field param, or the value for param, or null if neither is set.booleangetFieldBool(String field, String param, boolean def) Returns the boolean value of the field param, or the value for param, or def if neither is set.getFieldDouble(String field, String param) Returns the float value of the field param.doublegetFieldDouble(String field, String param, double def) Returns the float value of the field param, or the value for param, or def if neither is set.getFieldFloat(String field, String param) Returns the float value of the field param.floatgetFieldFloat(String field, String param, float def) Returns the float value of the field param, or the value for param, or def if neither is set.getFieldInt(String field, String param) Use this method only when you want to be explicit about absence of a value (null) vs the default value zero (0).intgetFieldInt(String field, String param, int def) Returns the int value of the field param, or the value for param, or def if neither is set.getFieldParam(String field, String param) returns the String value of the field parameter, "f.field.param", or the value for "param" if that is not set.getFieldParam(String field, String param, String def) returns the String value of the field parameter, "f.field.param", or the value for "param" if that is not set.String[]getFieldParams(String field, String param) returns the String values of the field parameter, "f.field.param", or the values for "param" if that is not set.Returns the Float value of the param, or null if not set Use this method only when you want to be explicit about absence of a value (null) vs the default value zero (0.0f).floatReturns the float value of the param, or def if not setReturns the Integer value of the param, or null if not set Use this method only when you want to be explicit about absence of a value (null) vs the default value for int - zero (0).intReturns the int value of the param, or def if not setReturns the Long value of the param, or null if not set Use this method only when you want to be explicit about absence of a value (null) vs the default value zero (0).longReturns the long value of the param, or def if not setReturns an Iterator over the parameter names.abstract String[]returns an array of the String values of a param, or null if no mapping for the param exists.booleangetPrimitiveBool(String param) Returns the boolean value of the param, orfalseif not setbooleangetPrimitiveFieldBool(String field, String param) Returns the boolean value of the field param, or the value for param or the default value of boolean -falsefloatgetPrimitiveFieldFloat(String field, String param) Returns the float value of the field param or the value for param or the default value for float - zero (0.0f)intgetPrimitiveInt(String param) Returns int value of the param or default value for int - zero (0) if not set.inthashCode()iterator()Returns an Iterator ofMap.Entryproviding a multi-map view.static SolrParamsof()An empty, immutable SolrParams.static SolrParamsAn immutable SolrParams holding one pair (not null).required()returns a RequiredSolrParams wrapping thisstream()AStreamview overiterator()-- for convenience.Generates a local-params string of the form{! name=value name2=value2}, Protecting (without any quoting or escaping) any values that start with$(param references).Deprecated.Returns this SolrParams as a proper URL encoded string, starting with"?", if not empty.toString()LiketoQueryString(), but only replacing enough chars so that the URL may be unambiguously pasted back into a browser.static SolrParamswrapAppended(SolrParams params, SolrParams defaults) static SolrParamswrapDefaults(SolrParams params, SolrParams defaults) voidWrites this object's entries out toew.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliteratorMethods inherited from interface org.apache.solr.common.NavigableObject
_forEachEntry, _forEachEntry, _forEachEntry, _get, _get, _getStr, _getStr, _size
-
Constructor Details
-
SolrParams
public SolrParams()
-
-
Method Details
-
get
Returns the first String value of a param, or null if not set. To get all, callgetParams(String)instead. -
getParams
returns an array of the String values of a param, or null if no mapping for the param exists. -
getParameterNamesIterator
Returns an Iterator over the parameter names. If you were to call a getter for this parameter, you should get a non-null value. Since you probably want the value, consider using Java 5 for-each style instead for convenience since a SolrParams implementsIterable. -
get
returns the value of the param, or def if not set -
writeMap
Description copied from interface:MapWriterWrites this object's entries out toew.- Specified by:
writeMapin interfaceMapWriter- Throws:
IOException
-
iterator
Returns an Iterator ofMap.Entryproviding a multi-map view. Treat it as read-only. -
stream
AStreamview overiterator()-- for convenience. Treat it as read-only. -
required
returns a RequiredSolrParams wrapping this -
fpname
-
getFieldParam
returns the String value of the field parameter, "f.field.param", or the value for "param" if that is not set. -
getFieldParam
returns the String value of the field parameter, "f.field.param", or the value for "param" if that is not set. If that is not set, def -
getFieldParams
returns the String values of the field parameter, "f.field.param", or the values for "param" if that is not set. -
getBool
Returns the Boolean value of the param, or null if not set. Use this method only when you want to be explicit about absence of a value (null) vs the default valuefalse.- See Also:
-
getPrimitiveBool
Returns the boolean value of the param, orfalseif not set -
getBool
Returns the boolean value of the param, or def if not set -
getFieldBool
Returns the Boolean value of the field param, or the value for param, or null if neither is set. Use this method only when you want to be explicit about absence of a value (null) vs the default valuefalse.- See Also:
-
getPrimitiveFieldBool
Returns the boolean value of the field param, or the value for param or the default value of boolean -false -
getFieldBool
Returns the boolean value of the field param, or the value for param, or def if neither is set. -
getInt
Returns the Integer value of the param, or null if not set Use this method only when you want to be explicit about absence of a value (null) vs the default value for int - zero (0).- See Also:
-
getPrimitiveInt
Returns int value of the param or default value for int - zero (0) if not set. -
getInt
Returns the int value of the param, or def if not set -
getLong
Returns the Long value of the param, or null if not set Use this method only when you want to be explicit about absence of a value (null) vs the default value zero (0).- See Also:
-
getLong
Returns the long value of the param, or def if not set -
getFieldInt
Use this method only when you want to be explicit about absence of a value (null) vs the default value zero (0).- Returns:
- The int value of the field param, or the value for param or
nullif neither is set. - See Also:
-
getFieldInt
Returns the int value of the field param, or the value for param, or def if neither is set. -
getFloat
Returns the Float value of the param, or null if not set Use this method only when you want to be explicit about absence of a value (null) vs the default value zero (0.0f).- See Also:
-
getFloat
Returns the float value of the param, or def if not set -
getDouble
Returns the Float value of the param, or null if not set Use this method only when you want to be explicit about absence of a value (null) vs the default value zero (0.0d).- See Also:
-
getDouble
Returns the float value of the param, or def if not set -
getFieldFloat
Returns the float value of the field param. Use this method only when you want to be explicit about absence of a value (null) vs the default value zero (0.0f).- See Also:
-
getPrimitiveFieldFloat
Returns the float value of the field param or the value for param or the default value for float - zero (0.0f) -
getFieldFloat
Returns the float value of the field param, or the value for param, or def if neither is set. -
getFieldDouble
Returns the float value of the field param. Use this method only when you want to be explicit about absence of a value (null) vs the default value zero (0.0d).- See Also:
-
getFieldDouble
Returns the float value of the field param, or the value for param, or def if neither is set. -
wrapDefaults
-
wrapAppended
-
toNamedList
Deprecated.Convert this to a NamedList of unique keys with either String or String[] values depending on how many values there are for the parameter. -
toQueryString
Returns this SolrParams as a proper URL encoded string, starting with"?", if not empty. -
toLocalParamsString
Generates a local-params string of the form{! name=value name2=value2}, Protecting (without any quoting or escaping) any values that start with$(param references). -
toString
LiketoQueryString(), but only replacing enough chars so that the URL may be unambiguously pasted back into a browser. This method can be used to properly log query parameters without making them unreadable.Characters with a numeric value less than 32 are encoded. &,=,%,+,space are encoded.
-
equals
A SolrParams is equal to another if they have the same keys and values. The order of keys does not matter. -
hashCode
public int hashCode() -
of
An empty, immutable SolrParams. -
of
An immutable SolrParams holding one pair (not null).
-
SimpleOrderedMap(MapWriter)