org.apache.solr.common.params

## Class SolrParams

- java.lang.Object
- - org.apache.solr.common.params.SolrParams

All Implemented Interfaces:
  Serializable

Direct Known Subclasses:
  DefaultSolrParams, MapSolrParams, ModifiableSolrParams, MultiMapSolrParams, RequiredSolrParams

    public abstract class SolrParams
    extends Object
    implements Serializable

SolrParams hold request parameters.

See Also:
  Serialized Form

### Constructor Summary

Constructors
Constructor and Description
`SolrParams()`

### Method Summary

All Methods Static Methods Instance Methods Abstract Methods Concrete Methods
`protected String` `fpname(String field, String param)`
`abstract String` `get(String param)` returns the String value of a param, or null if not set
`String` `get(String param, String def)` returns the value of the param, or def if not set
`Map<String,Object>` `getAll(Map<String,Object> sink, Collection<String> params)`
`Map<String,Object>` `getAll(Map<String,Object> sink, String... params)` Copy all params to the given map or if the given map is null create a new one
`Boolean` `getBool(String param)` Returns the Boolean value of the param, or null if not set
`boolean` `getBool(String param, boolean def)` Returns the boolean value of the param, or def if not set
`Double` `getDouble(String param)` Returns the Float value of the param, or null if not set
`double` `getDouble(String param, double def)` Returns the float value of the param, or def if not set
`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.
`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.
`Double` `getFieldDouble(String field, String param)` Returns the float value of the field param.
`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.
`Float` `getFieldFloat(String field, String param)` Returns the float value of the field param.
`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.
`Integer` `getFieldInt(String field, String param)`
`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.
`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.
`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.
`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.
`Float` `getFloat(String param)` Returns the Float value of the param, or null if not set
`float` `getFloat(String param, float def)` Returns the float value of the param, or def if not set
`Integer` `getInt(String param)` Returns the Integer value of the param, or null if not set
`int` `getInt(String param, int def)` Returns the int value of the param, or def if not set
`Long` `getLong(String param)` Returns the Long value of the param, or null if not set
`long` `getLong(String param, long def)` Returns the long value of the param, or def if not set
`Long` `getLong(String param, Long def)` Returns the Long value of the param, or null if not set
`abstract 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 none
`RequiredSolrParams` `required()` returns a RequiredSolrParams wrapping this
`SolrParams` `toFilteredSolrParams(List<String> names)` Create filtered SolrParams.
`static Map<String,String>` `toMap(NamedList params)` Create a Map<String,String> from a NamedList given no keys are repeated
`static Map<String,String[]>` `toMultiMap(NamedList params)` Create a Map<String,String[]> from a NamedList
`NamedList<Object>` `toNamedList()` Convert this to a NamedList
`String` `toQueryString()` Returns this SolrParams as a properly URL encoded string, starting with `"?"`, if not empty.
`static SolrParams` `toSolrParams(NamedList params)` Create SolrParams from NamedList.
`String` `toString()` Like `toQueryString()`, but only replacing enough chars so that the URL may be unambiguously pasted back into a browser.
`static SolrParams` `wrapAppended(SolrParams params, SolrParams defaults)`
`static SolrParams` `wrapDefaults(SolrParams params, SolrParams defaults)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Constructor Detail

#### SolrParams

    public SolrParams()

### Method Detail

#### get

    public abstract String get(String param)

returns the String value of a param, or null if not set

#### getParams

    public abstract String[] getParams(String param)

returns an array of the String values of a param, or null if none

#### getParameterNamesIterator

    public abstract Iterator<String> getParameterNamesIterator()

returns an Iterator over the parameter names

#### get

    public String get(String param,
                      String def)

returns the value of the param, or def if not set

#### required

    public RequiredSolrParams required()

returns a RequiredSolrParams wrapping this

#### fpname

    protected String fpname(String field,
                            String param)

#### getFieldParam

    public 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.

#### getFieldParam

    public 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

#### getFieldParams

    public 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.

#### getBool

    public Boolean getBool(String param)

Returns the Boolean value of the param, or null if not set

#### getBool

    public boolean getBool(String param,
                           boolean def)

Returns the boolean value of the param, or def if not set

#### getFieldBool

    public 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.

#### getFieldBool

    public 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.

#### getInt

    public Integer getInt(String param)

Returns the Integer value of the param, or null if not set

#### getLong

    public Long getLong(String param,
                        Long def)

Returns the Long value of the param, or null if not set

#### getInt

    public int getInt(String param,
                      int def)

Returns the int value of the param, or def if not set

#### getLong

    public Long getLong(String param)

Returns the Long value of the param, or null if not set

#### getLong

    public long getLong(String param,
                        long def)

Returns the long value of the param, or def if not set

#### getFieldInt

    public Integer getFieldInt(String field,
                               String param)

Returns:
  The int value of the field param, or the value for param or `null` if neither is set.

#### getFieldInt

    public 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.

#### getFloat

    public Float getFloat(String param)

Returns the Float value of the param, or null if not set

#### getFloat

    public float getFloat(String param,
                          float def)

Returns the float value of the param, or def if not set

#### getDouble

    public Double getDouble(String param)

Returns the Float value of the param, or null if not set

#### getDouble

    public double getDouble(String param,
                            double def)

Returns the float value of the param, or def if not set

#### getFieldFloat

    public Float getFieldFloat(String field,
                               String param)

Returns the float value of the field param.

#### getFieldFloat

    public 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.

#### getFieldDouble

    public Double getFieldDouble(String field,
                                 String param)

Returns the float value of the field param.

#### getFieldDouble

    public 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.

#### wrapDefaults

    public static SolrParams wrapDefaults(SolrParams params,
                                          SolrParams defaults)

#### wrapAppended

    public static SolrParams wrapAppended(SolrParams params,
                                          SolrParams defaults)

#### toMap

    public static Map<String,String> toMap(NamedList params)

Create a Map<String,String> from a NamedList given no keys are repeated

#### toMultiMap

    public static Map<String,String[]> toMultiMap(NamedList params)

Create a Map<String,String[]> from a NamedList

#### toSolrParams

    public static SolrParams toSolrParams(NamedList params)

Create SolrParams from NamedList.

#### toFilteredSolrParams

    public SolrParams toFilteredSolrParams(List<String> names)

Create filtered SolrParams.

#### toNamedList

    public NamedList<Object> toNamedList()

Convert this to a NamedList

#### getAll

    public Map<String,Object> getAll(Map<String,Object> sink,
                                     Collection<String> params)

#### getAll

    public Map<String,Object> getAll(Map<String,Object> sink,
                                     String... params)

Copy all params to the given map or if the given map is null create a new one

#### toQueryString

    public String toQueryString()

Returns this SolrParams as a properly URL encoded string, starting with `"?"`, if not empty.

#### toString

    public String toString()

Like `toQueryString()`, 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.

Overrides:
  `toString` in class `Object`