org.apache.solr.request
Class SolrParams

java.lang.Object
  extended by org.apache.solr.request.SolrParams
Direct Known Subclasses:
DefaultSolrParams, MapSolrParams, MultiMapSolrParams, RequiredSolrParams

public abstract class SolrParams
extends Object

SolrParams hold request parameters.

Version:
$Id$
Author:
yonik

Nested Class Summary
static class SolrParams.EchoParamStyle
          valid values for: echoParams
 
Field Summary
static String DEBUG_QUERY
          whether to include debug data
static String DF
          default query field
static String EXPLAIN_OTHER
          another query to explain against
static String FACET
          Should facet counts be calculated?
static String FACET_ENUM_CACHE_MINDF
          When faceting by enumerating the terms in a field, only use the filterCache for terms with a df >= to this parameter.
static String FACET_FIELD
          Any field whose terms the user wants to enumerate over for Facet Contraint Counts (multi-value)
static String FACET_LIMIT
          Numeric option indicating the maximum number of facet field counts be included in the response for each field - in descending order of count.
static String FACET_MINCOUNT
          Numeric option indicating the minimum number of hits before a facet should be included in the response.
static String FACET_MISSING
          Boolean option indicating whether the response should include a facet field count for all records which have no value for the facet field.
static String FACET_OFFSET
          The offset into the list of facets.
static String FACET_PREFIX
          Only return constraints of a facet field with the given prefix.
static String FACET_QUERY
          Any lucene formated queries the user would like to use for Facet Contraint Counts (multi-value)
static String FACET_SORT
          Boolean option: true causes facets to be sorted by the count, false results in natural index order.
static String FACET_ZEROS
          Boolean option indicating whether facet field counts of "0" should be included in the response.
static String FL
          query and init param for field list
static String FQ
          Lucene query string(s) for filtering the results without affecting scoring
static String HEADER_ECHO_HANDLER
          'true' if the header should include the handler name
static String HEADER_ECHO_PARAMS
          include the parameters in the header
static String Q
          query string
static String QT
          the query type - which query handler should handle the request
static String ROWS
          number of documents to return starting at "start"
static String SORT
          sort order
static String START
          zero based offset of matching documents to retrieve
static String STREAM_BODY
          If the content stream should come directly from a field
static String STREAM_CONTENTTYPE
          Explicity set the content type for the input stream If multiple streams are specified, the explicit contentType will be used for all of them.
static String STREAM_FILE
          If the content stream should come from a File (using FileReader)
static String STREAM_URL
          If the content stream should come from a URL (using URLConnection)
static String VERSION
          stylesheet to apply to XML results
static String WT
          the response writer type - the format of the response
static String XSL
          stylesheet to apply to XML results
 
Constructor Summary
SolrParams()
           
 
Method Summary
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
 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
 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.
 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)
          Returns the int value of the field param, or the value for param, or def if neither is set.
 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
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
protected  boolean parseBool(String s)
          how to transform a String into a boolean...
 RequiredSolrParams required()
          returns a RequiredSolrParams wrapping this
static Map<String,String> toMap(NamedList params)
          Create a Map from a NamedList given no keys are repeated
static Map<String,String[]> toMultiMap(NamedList params)
          Create a Map from a NamedList
 NamedList<Object> toNamedList()
          Convert this to a NamedList
static SolrParams toSolrParams(NamedList params)
          Create SolrParams from NamedList.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

QT

public static final String QT
the query type - which query handler should handle the request

See Also:
Constant Field Values

WT

public static final String WT
the response writer type - the format of the response

See Also:
Constant Field Values

Q

public static final String Q
query string

See Also:
Constant Field Values

SORT

public static final String SORT
sort order

See Also:
Constant Field Values

FQ

public static final String FQ
Lucene query string(s) for filtering the results without affecting scoring

See Also:
Constant Field Values

START

public static final String START
zero based offset of matching documents to retrieve

See Also:
Constant Field Values

ROWS

public static final String ROWS
number of documents to return starting at "start"

See Also:
Constant Field Values

XSL

public static final String XSL
stylesheet to apply to XML results

See Also:
Constant Field Values

VERSION

public static final String VERSION
stylesheet to apply to XML results

See Also:
Constant Field Values

FL

public static final String FL
query and init param for field list

See Also:
Constant Field Values

DF

public static final String DF
default query field

See Also:
Constant Field Values

DEBUG_QUERY

public static final String DEBUG_QUERY
whether to include debug data

See Also:
Constant Field Values

EXPLAIN_OTHER

public static final String EXPLAIN_OTHER
another query to explain against

See Also:
Constant Field Values

FACET

public static final String FACET
Should facet counts be calculated?

See Also:
Constant Field Values

FACET_QUERY

public static final String FACET_QUERY
Any lucene formated queries the user would like to use for Facet Contraint Counts (multi-value)

See Also:
Constant Field Values

FACET_FIELD

public static final String FACET_FIELD
Any field whose terms the user wants to enumerate over for Facet Contraint Counts (multi-value)

See Also:
Constant Field Values

FACET_OFFSET

public static final String FACET_OFFSET
The offset into the list of facets. Can be overriden on a per field basis.

See Also:
Constant Field Values

FACET_LIMIT

public static final String FACET_LIMIT
Numeric option indicating the maximum number of facet field counts be included in the response for each field - in descending order of count. Can be overriden on a per field basis.

See Also:
Constant Field Values

FACET_MINCOUNT

public static final String FACET_MINCOUNT
Numeric option indicating the minimum number of hits before a facet should be included in the response. Can be overriden on a per field basis.

See Also:
Constant Field Values

FACET_ZEROS

public static final String FACET_ZEROS
Boolean option indicating whether facet field counts of "0" should be included in the response. Can be overriden on a per field basis.

See Also:
Constant Field Values

FACET_MISSING

public static final String FACET_MISSING
Boolean option indicating whether the response should include a facet field count for all records which have no value for the facet field. Can be overriden on a per field basis.

See Also:
Constant Field Values

FACET_SORT

public static final String FACET_SORT
Boolean option: true causes facets to be sorted by the count, false results in natural index order.

See Also:
Constant Field Values

FACET_PREFIX

public static final String FACET_PREFIX
Only return constraints of a facet field with the given prefix.

See Also:
Constant Field Values

FACET_ENUM_CACHE_MINDF

public static final String FACET_ENUM_CACHE_MINDF
When faceting by enumerating the terms in a field, only use the filterCache for terms with a df >= to this parameter.

See Also:
Constant Field Values

STREAM_URL

public static final String STREAM_URL
If the content stream should come from a URL (using URLConnection)

See Also:
Constant Field Values

STREAM_FILE

public static final String STREAM_FILE
If the content stream should come from a File (using FileReader)

See Also:
Constant Field Values

STREAM_BODY

public static final String STREAM_BODY
If the content stream should come directly from a field

See Also:
Constant Field Values

STREAM_CONTENTTYPE

public static final String STREAM_CONTENTTYPE
Explicity set the content type for the input stream If multiple streams are specified, the explicit contentType will be used for all of them.

See Also:
Constant Field Values

HEADER_ECHO_HANDLER

public static final String HEADER_ECHO_HANDLER
'true' if the header should include the handler name

See Also:
Constant Field Values

HEADER_ECHO_PARAMS

public static final String HEADER_ECHO_PARAMS
include the parameters in the header

See Also:
Constant Field Values
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


getInt

public int getInt(String param,
                  int def)
Returns the int 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 def 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


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.


parseBool

protected boolean parseBool(String s)
how to transform a String into a boolean... more flexible than Boolean.parseBoolean() to enable easier integration with html forms.


toMap

public static Map<String,String> toMap(NamedList params)
Create a Map from a NamedList given no keys are repeated


toMultiMap

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


toSolrParams

public static SolrParams toSolrParams(NamedList params)
Create SolrParams from NamedList.


toNamedList

public NamedList<Object> toNamedList()
Convert this to a NamedList



Copyright © 2006 - 2009 The Apache Software Foundation