Dear Wiki user, You have subscribed to a wiki page or wiki category on "Solr Wiki" for change notification.
The following page has been changed by HossMan: http://wiki.apache.org/solr/StandardRequestHandler ------------------------------------------------------------------------------ The [http://incubator.apache.org/solr/docs/api/ Standard Request Handler] is the default Query handler included in the standard Solr distribution. It is usually registered in the solrconfig.xml with the query type "standard", and while it's certianly possible to reconfigure Solr so that a different handler is registered with that query type -- it is discouraged. (Doing so would most likely confuse a great many people) - == Query Params == + = Query Params = In addition to the CoreQueryParameters, the Standard Request Handler supports the following Query Parameters... - === q === + == q == This is the only mandatory query parameter. It must be a query parsable according to the [http://lucene.apache.org/java/docs/queryparsersyntax.html Lucene Query Parser Syntax], followed by an optional sort specification. Examples: @@ -19, +19 @@ Other then the optional sort specification the only difference between how this query string is parsed, and hose the Lucene QueryParser works, is that by default, the Solr QueryParser uses constant score variations of Range and Prefix queries by default, so you don't need to worry about the dreaded "Too Many Clauses" exception. - === start === + == start == This paramater is used to paginate results from a query. When specified, it indicates the offset in the complete result set for the queries where the set of returned documents should begin. The default value is "`0`". - === rows === + == rows == This paramater is used to paginate results from a query. When specified, it indicates the maximum number of documents from the complete result set to return to the client. The default value is "`10`" - === fl === + == fl == This parameter can be used to specify a set of fields to use to limit the amount of information in the response. When returning the results to the client, only fields in this list will be included. @@ -51, +51 @@ The default value is "`*`" - === debugQuery === + == debugQuery == - /!\ :TODO: /!\ finish + If this parameter is present (regardless of it's value) then additional debugging information will be included in the response, including "explain" info for each of the documents returned. - === explainOther === + The default behavior is not to include debugging info. - /!\ :TODO: /!\ finish + == explainOther == + This parameter allows clients to specify a Lucene query to identify a set of documents. If non-blank, the explain info of each document which matches this query, relative the ''main query'' (specified by the q parameter) will be returned along with the rest of the debugging information. + + The default value is blank (ie: no extra explain info will be returned) + + = Response = + + By default, the response from the Standard Query Handler contains one `<result>` block, which is unamed. If the `debugQuery` parameter is used, then an additional `<lst>` block will be returned, using the name "debug". This will contain some usefull debuging info, including the orriginal query string, the parsed query string, and explain info for each document in the `<result>` block. If the `explainOther` parameter is also used, then additional explain info will be provided for all of documents matching that query. + + == Sample Responses == + + These are some examples of what the response might look like for various query URLs... + + === A simple query that returns one document === + + `http://yourhost.tld:9999/solr/select?q=id%3ASP2514N&version=2.1&indent=1` + + {{{ + <?xml version="1.0" encoding="UTF-8"?> + <response> + <responseHeader><status>0</status><QTime>1</QTime></responseHeader> + + <result numFound="1" start="0"> + <doc> + <arr name="cat"><str>electronics</str><str>hard drive</str></arr> + <arr name="features"><str>7200RPM, 8MB cache, IDE Ultra ATA-133</str><str>NoiseGuard, SilentSeek technology, Fluid Dynamic Bearing (FDB) motor</str></arr> + + <str name="id">SP2514N</str> + <bool name="inStock">true</bool> + <str name="manu">Samsung Electronics Co. Ltd.</str> + <str name="name">Samsung SpinPoint P120 SP2514N - hard drive - 250 GB - ATA-133</str> + <int name="popularity">6</int> + <float name="price">92.0</float> + + <str name="sku">SP2514N</str> + </doc> + </result> + </response> + }}} + + === A simple query for one document, with a limited field list === + + `http://yourhost.tld:9999/solr/select?q=id%3ASP2514N&version=2.1&indent=1&fl=id+name` + {{{ + <?xml version="1.0" encoding="UTF-8"?> + <response> + <responseHeader><status>0</status><QTime>2</QTime></responseHeader> + + <result numFound="1" start="0"> + <doc> + <str name="id">SP2514N</str> + <str name="name">Samsung SpinPoint P120 SP2514N - hard drive - 250 GB - ATA-133</str> + </doc> + + </result> + </response> + }}} + + === A limited number of fields, plus the scores of the first 2 documents in the result set === + + `http://yourhost.tld:9999/solr/select?q=cat%3Aelectronics+Belkin&version=2.1&start=0&rows=2&indent=on&fl=id+name+score` + {{{ + <?xml version="1.0" encoding="UTF-8"?> + <response> + <responseHeader><status>0</status><QTime>6</QTime></responseHeader> + + <result numFound="14" start="0" maxScore="1.0851374"> + <doc> + <float name="score">1.0851374</float> + <str name="id">F8V7067-APL-KIT</str> + <str name="name">Belkin Mobile Power Cord for iPod w/ Dock</str> + + </doc> + <doc> + <float name="score">0.68052477</float> + <str name="id">IW-02</str> + <str name="name">iPod & iPod Mini USB 2.0 Cable</str> + </doc> + + </result> + </response> + }}} + + === The third and Fourth documents in the result set === + + `http://yourhost.tld:9999/solr/select?q=cat%3Aelectronics+Belkin&version=2.1&start=2&rows=2&indent=on&fl=id+name+score` + {{{ + <?xml version="1.0" encoding="UTF-8"?> + <response> + <responseHeader><status>0</status><QTime>2</QTime></responseHeader> + + <result numFound="14" start="2" maxScore="1.0851374"> + <doc> + <float name="score">0.11182726</float> + <str name="id">MA147LL/A</str> + <str name="name">Apple 60 GB iPod with Video Playback Black</str> + + </doc> + <doc> + <float name="score">0.11182726</float> + <str name="id">TWINX2048-3200PRO</str> + <str name="name">CORSAIR XMS 2GB (2 x 1GB) 184-Pin DDR SDRAM Unbuffered DDR 400 (PC 3200) Dual Channel Kit System Memory - Retail</str> + </doc> + </result> + </response> + }}} + + === The second document in the result set with and debuging info (including it's score explanation) === + + `http://yourhost.tld:9999/solr/select?q=cat%3Aelectronics+Belkin&version=2.1&start=1&rows=1&indent=on&fl=id+name+score&debugQuery=` + {{{ + <?xml version="1.0" encoding="UTF-8"?> + <response> + <responseHeader><status>0</status><QTime>13</QTime></responseHeader> + + <result numFound="14" start="1" maxScore="1.0851374"> + <doc> + <float name="score">0.68052477</float> + <str name="id">IW-02</str> + <str name="name">iPod & iPod Mini USB 2.0 Cable</str> + + </doc> + </result> + <lst name="debug"> + <str name="querystring">cat:electronics Belkin</str> + <str name="parsedquery">cat:electronics text:belkin</str> + <lst name="explain"> + <str name="id=IW-02,internal_docid=3"> + 0.6805248 = sum of: + 0.22365452 = weight(cat:electronics in 3), product of: + 0.35784724 = queryWeight(cat:electronics), product of: + 1.0 = idf(docFreq=14) + 0.35784724 = queryNorm + 0.625 = fieldWeight(cat:electronics in 3), product of: + 1.0 = tf(termFreq(cat:electronics)=1) + 1.0 = idf(docFreq=14) + 0.625 = fieldNorm(field=cat, doc=3) + 0.4568703 = weight(text:belkin in 3), product of: + 0.9337802 = queryWeight(text:belkin), product of: + 2.609438 = idf(docFreq=2) + 0.35784724 = queryNorm + 0.4892696 = fieldWeight(text:belkin in 3), product of: + 1.0 = tf(termFreq(text:belkin)=1) + 2.609438 = idf(docFreq=2) + 0.1875 = fieldNorm(field=text, doc=3) + </str> + </lst> + + </lst> + </response> + }}} + + === One document in a result set, and the explain info for another document === + + `http://localhost:8983/solr/select?q=cat%3Aelectronics+Belkin&version=2.1&start=1&rows=1&indent=on&fl=id+name+score&explainOther=id%3A6H500F0&debugQuery=` + {{{ + <?xml version="1.0" encoding="UTF-8"?> + <response> + <responseHeader><status>0</status><QTime>7</QTime></responseHeader> + + <result numFound="14" start="1" maxScore="1.0851374"> + <doc> + <float name="score">0.68052477</float> + <str name="id">IW-02</str> + <str name="name">iPod & iPod Mini USB 2.0 Cable</str> + + </doc> + </result> + <lst name="debug"> + <str name="querystring">cat:electronics Belkin</str> + <str name="parsedquery">cat:electronics text:belkin</str> + <lst name="explain"> + <str name="id=IW-02,internal_docid=3"> + 0.6805248 = sum of: + 0.22365452 = weight(cat:electronics in 3), product of: + 0.35784724 = queryWeight(cat:electronics), product of: + 1.0 = idf(docFreq=14) + 0.35784724 = queryNorm + 0.625 = fieldWeight(cat:electronics in 3), product of: + 1.0 = tf(termFreq(cat:electronics)=1) + 1.0 = idf(docFreq=14) + 0.625 = fieldNorm(field=cat, doc=3) + 0.4568703 = weight(text:belkin in 3), product of: + 0.9337802 = queryWeight(text:belkin), product of: + 2.609438 = idf(docFreq=2) + 0.35784724 = queryNorm + 0.4892696 = fieldWeight(text:belkin in 3), product of: + 1.0 = tf(termFreq(text:belkin)=1) + 2.609438 = idf(docFreq=2) + 0.1875 = fieldNorm(field=text, doc=3) + </str> + </lst> + + <str name="otherQuery">id:6H500F0</str> + <lst name="explainOther"> + <str name="id=6H500F0,internal_docid=1"> + 0.08946181 = product of: + 0.17892362 = weight(cat:electronics in 1), product of: + 0.35784724 = queryWeight(cat:electronics), product of: + 1.0 = idf(docFreq=14) + 0.35784724 = queryNorm + 0.5 = fieldWeight(cat:electronics in 1), product of: + 1.0 = tf(termFreq(cat:electronics)=1) + 1.0 = idf(docFreq=14) + 0.5 = fieldNorm(field=cat, doc=1) + 0.5 = coord(1/2) + </str> + </lst> + </lst> + </response> + }}} +
