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
 - 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.- See Also:
- Serialized Form
 
- 
- 
Nested Class Summary- 
Nested classes/interfaces inherited from interface org.apache.solr.common.MapWriterMapWriter.EntryWriter
 
- 
 - 
Constructor SummaryConstructors Constructor Description SolrParams()
 - 
Method SummaryAll Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected Stringfpname(String field, String param)abstract Stringget(String param)Returns the first String value of a param, or null if not set.Stringget(String param, String def)returns the value of the param, or def if not setMap<String,Object>getAll(Map<String,Object> sink, String... params)Deprecated.Map<String,Object>getAll(Map<String,Object> sink, Collection<String> params)Deprecated.BooleangetBool(String param)Returns the Boolean value of the param, or null if not set.booleangetBool(String param, boolean def)Returns the boolean value of the param, or def if not setDoublegetDouble(String param)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).doublegetDouble(String param, double def)Returns the float value of the param, or def if not setBooleangetFieldBool(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.DoublegetFieldDouble(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.FloatgetFieldFloat(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.IntegergetFieldInt(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.StringgetFieldParam(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.StringgetFieldParam(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.FloatgetFloat(String param)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).floatgetFloat(String param, float def)Returns the float value of the param, or def if not setIntegergetInt(String param)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).intgetInt(String param, int def)Returns the int value of the param, or def if not setLonggetLong(String param)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).longgetLong(String param, long def)Returns the long value of the param, or def if not setabstract Iterator<String>getParameterNamesIterator()Returns an Iterator over the parameter names.abstract String[]getParams(String param)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 the param or default value for int - zero (0) if not set.Iterator<Map.Entry<String,String[]>>iterator()Returns an Iterator ofMap.Entryproviding a multi-map view.RequiredSolrParamsrequired()returns a RequiredSolrParams wrapping thisStream<Map.Entry<String,String[]>>stream()AStreamview overiterator()-- for convenience.SolrParamstoFilteredSolrParams(List<String> names)Deprecated.StringtoLocalParamsString()Generates a local-params string of the formstatic Map<String,String>toMap(NamedList<?> params)Deprecated.static Map<String,String[]>toMultiMap(NamedList<?> params)Deprecated.NamedList<Object>toNamedList()Convert this to a NamedList of unique keys with either String or String[] values depending on how many values there are for the parameter.StringtoQueryString()Returns this SolrParams as a properly URL encoded string, starting with"?", if not empty.static SolrParamstoSolrParams(NamedList<?> params)Deprecated.StringtoString()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)voidwriteMap(MapWriter.EntryWriter ew)- 
Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 - 
Methods inherited from interface java.lang.IterableforEach, spliterator
 - 
Methods inherited from interface org.apache.solr.common.NavigableObject_forEachEntry, _forEachEntry, _forEachEntry, _get, _get, _getStr, _getStr, _size
 
- 
 
- 
- 
- 
Method Detail- 
getpublic abstract String get(String param) Returns the first String value of a param, or null if not set. To get all, callgetParams(String)instead.
 - 
getParamspublic abstract String[] getParams(String param) returns an array of the String values of a param, or null if no mapping for the param exists.
 - 
getParameterNamesIteratorpublic abstract Iterator<String> 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.
 - 
writeMappublic void writeMap(MapWriter.EntryWriter ew) throws IOException - Specified by:
- writeMapin interface- MapWriter
- Throws:
- IOException
 
 - 
iteratorpublic Iterator<Map.Entry<String,String[]>> iterator() Returns an Iterator ofMap.Entryproviding a multi-map view. Treat it as read-only.
 - 
streampublic Stream<Map.Entry<String,String[]>> stream() AStreamview overiterator()-- for convenience. Treat it as read-only.
 - 
requiredpublic RequiredSolrParams required() returns a RequiredSolrParams wrapping this
 - 
getFieldParampublic String 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.
 - 
getFieldParampublic String 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. If that is not set, def
 - 
getFieldParamspublic 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.
 - 
getBoolpublic Boolean getBool(String param) 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:
- getBool(String, boolean),- getPrimitiveBool(String)
 
 - 
getPrimitiveBoolpublic boolean getPrimitiveBool(String param) Returns the boolean value of the param, orfalseif not set
 - 
getBoolpublic boolean getBool(String param, boolean def) Returns the boolean value of the param, or def if not set
 - 
getFieldBoolpublic Boolean getFieldBool(String field, String param) 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.
 - 
getPrimitiveFieldBoolpublic boolean getPrimitiveFieldBool(String field, String param) Returns the boolean value of the field param, or the value for param or the default value of boolean -false
 - 
getFieldBoolpublic boolean getFieldBool(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.
 - 
getIntpublic Integer getInt(String param) 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:
- getInt(String, int),- getPrimitiveInt(String)
 
 - 
getPrimitiveIntpublic int getPrimitiveInt(String param) Returns int value of the the param or default value for int - zero (0) if not set.
 - 
getIntpublic int getInt(String param, int def) Returns the int value of the param, or def if not set
 - 
getLongpublic Long getLong(String param) 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(String, long)
 
 - 
getLongpublic long getLong(String param, long def) Returns the long value of the param, or def if not set
 - 
getFieldIntpublic Integer 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).- Returns:
- The int value of the field param, or the value for param or nullif neither is set.
- See Also:
- getFieldInt(String, String, int)
 
 - 
getFieldIntpublic int getFieldInt(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.
 - 
getFloatpublic Float getFloat(String param) 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(String, float)
 
 - 
getFloatpublic float getFloat(String param, float def) Returns the float value of the param, or def if not set
 - 
getDoublepublic Double getDouble(String param) 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(String, double)
 
 - 
getDoublepublic double getDouble(String param, double def) Returns the float value of the param, or def if not set
 - 
getFieldFloatpublic Float getFieldFloat(String field, String param) 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).
 - 
getPrimitiveFieldFloatpublic float getPrimitiveFieldFloat(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)
 - 
getFieldFloatpublic float getFieldFloat(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.
 - 
getFieldDoublepublic Double getFieldDouble(String field, String param) 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:
- getDouble(String, double)
 
 - 
getFieldDoublepublic double getFieldDouble(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.
 - 
wrapDefaultspublic static SolrParams wrapDefaults(SolrParams params, SolrParams defaults) 
 - 
wrapAppendedpublic static SolrParams wrapAppended(SolrParams params, SolrParams defaults) 
 - 
toMap@Deprecated public static Map<String,String> toMap(NamedList<?> params) Deprecated.Create a Map<String,String> from a NamedList given no keys are repeated
 - 
toMultiMap@Deprecated public static Map<String,String[]> toMultiMap(NamedList<?> params) Deprecated.Create a Map<String,String[]> from a NamedList
 - 
toSolrParams@Deprecated public static SolrParams toSolrParams(NamedList<?> params) Deprecated.Create SolrParams from NamedList.
 - 
toFilteredSolrParams@Deprecated public SolrParams toFilteredSolrParams(List<String> names) Deprecated.
 - 
toNamedListpublic NamedList<Object> toNamedList() Convert this to a NamedList of unique keys with either String or String[] values depending on how many values there are for the parameter.
 - 
getAll@Deprecated public Map<String,Object> getAll(Map<String,Object> sink, Collection<String> params) Deprecated.
 - 
getAll@Deprecated public Map<String,Object> getAll(Map<String,Object> sink, String... params) Deprecated.Copy all params to the given map or if the given map is null create a new one
 - 
toQueryStringpublic String toQueryString() Returns this SolrParams as a properly URL encoded string, starting with"?", if not empty.
 - 
toLocalParamsStringpublic String toLocalParamsString() Generates a local-params string of the form{! name=value name2=value2}
 - 
toStringpublic String 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. 
 
- 
 
-