Common query parameters

The following are the common query parameters supported by standard query parser, DisMax query parser, and extended DisMax query parser:

Parameter Behavior Default value

defType

Selects the query parser:

defType=dismax

Lucene (standard query parser)

sort

Sorts the search results in either ascending or descending order. The value can be specified as asc or ASC and desc or DESC. Sorting is supported by numerical or alphabetical content. Solr supports sorting by field clones.

Example:

  • salary asc: Sorts based on salary (high to low).
  • name desc: Sorts based on names (z  a).
  • salary asc name desc: First sorts by salary high to low. Within that, it sorts the result set again sorts by name (z → a).

desc

start

Specifies the starting point from where the results should begin displaying.

0

rows

Specifies the maximum number of documents to be returned to the client from the complete result set at a time.

10

fq

Limits the result set to the documents matched by the filter query (fq) without affecting the score.

fl

Specifies the field list to be returned inside the response for each matching document. The fields can be specified by a space or comma. For example:

  • fl=id name salary: Returns only id, name, and salary
  • fl=id,name,salary: Returns only id, name, and salary

Indicating fl=* will return all the fields. We also can return the score of fields for each document by mentioning the score string along with the fields. For example:

  • fl=id score: Returns the id field and the score
  • fl=* score: Returns all the fields in each document along with each field's score

*

debug

Returns debug information about the specified value. For example:

  • debug=query will return debug information about the query
  • debug=timing will return debug information about the processing time of the query
  • debug=results will return debug information about the score results (explain)
  • debug=all or debug=true will return all debugging information for the request

Not including debugging information

explainOther

This specifies a Lucene query that will return debugging information with the explain information of each document matching to that Lucene query, relative to the original query (specified by the q parameter). For example:

q=soccer&debug=true&explainOther=id:cricket

The preceding query calculates the scoring explain info of the top matching documents and compares with the explain info for the documents matching id:cricket.

blank

wt

Specifies a response writer format. Supported formats are jsonxml, xslt, javabin, geojson, python, php, phps, ruby, csv, velocity, smile, and  xlsx.

json

omitHeader

Tells Solr to include or exclude header information from the returned results; omitHeader=true will exclude the header information from the returned results.

false

cache

This tells Solr to cache results of all queries and filter queries. If set to false, it will disable result caching.

true

Apart from the preceding common parameters for parsers, timeAllowed, segmentTerminateEarly, logParamsList, and echoParams are also common parameters which are used by all the parsers. We are not detailing these parameters here.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.217.254.118