SOLR Query Parameter description

Source: Internet
Author: User
Tags bool json regular expression solr solr query sort


The original text goes to: http://blog.csdn.net/yuwenruli/article/details/8448575


SOLR Query Parameter Description:
http://localhost:8983/solr/solr_select/query?q=*:* &fl=id




The parameters are described as follows:
Q – Query string, required. queries that are searched for in SOLR. For a complete description of the syntax, see "Lucene queryparser Syntax" in resources. You can include sorting information by appending a semicolon and the name of a field that has been indexed and not broken word. The default sort is score
DESC, which refers to descending sort by score. Q=myfield:java and Otherfield:developerworks; Date ASC This query searches for the specified two fields and sorts the results based on a date field.
start– returns the offset position of the first record in the full found result, starting at 0, for general paging.
rows– Specifies the maximum number of records to return, with start to implement paging.
sort– sort, Format: Sort=<field Name>+<desc|asc>[,<field name>+<desc|asc>] .... Example: (Instock desc, price asc) means "instock" descending, then "price" ascending, and the default is correlation descending.
wt– (writer type) specifies the output format, which can have XML, JSON, PHP, Phps, and later SOLR 1.3 additions, to be notified to us, because the default is not turned on.
fq– filter query, function: In the Q query conforms to the results of the FQ query is also consistent,
Fl-field as a comma-delimited list specifies the Field set that should be returned in the document results. The default is "*", which refers to all fields. "Score" means that the score should also be returned. such as *,score
All fields and scores are returned. When using a SOLRJ bean, you have to specify Query.set ("FL", "*,score") in query.
q.op– overrides the Schema.xml Defaultoperator (with a space with "and" or "or" Operation Logic), which is typically specified by default
df– default query fields, which are typically specified by default
qt– (query type) specifies that type to handle query requests, which are generally not specified and are standard by default.
indent– returns whether the result is indented, closed by default, Indent=true|on on, general debugging Json,php,phps,ruby output is necessary to use this parameter.
version– the version of the query syntax, it is recommended that you do not use it and specify the default value by the server.




Hight
Hl-highlight,h1=true, indicating the use of highlighting. You can use H1.fl=field1,field2 to set the highlighted field.
HL.FL: A list of fields separated by a space or comma. To enable the highlight function of a field, you have to ensure that the field is stored in the schema. If the parameter is not given, then the default field, standard handler, is used with the DF parameter, and the Dismax field is used with the QF parameter. You can use asterisks to highlight all the fields conveniently. If you are using wildcard characters, consider enabling the Hl.requiredfieldmatch option.
Hl.requirefieldmatch:
If true, the field will be highlighted unless the query result is not empty. Its default value is False, which means it may match a field but highlight a different field. If a wildcard character is used by HL.FL, then this parameter must be enabled. However, if your query is the all field (possibly using the Copy-field Directive), set it to false so that the search results indicate which field the query text is not found
Hl.usephrasehighlighter:
If a query contains a phrase (the quotation marks are framed) then it is guaranteed that the exact phrase must be matched to be highlighted.
Hl.highlightmultiterm
If you use wildcards and fuzzy searches, you will ensure that the term that matches the wildcard character is highlighted. The default is False, and hl.usephrasehighlighter to true.
Hl.snippets:
This is the maximum number of highlighted fragments. The default value is 1 and is almost never modified. If the value of a particular field is set to 0 (for example, f.alltext.hl.snippets=0), this indicates that the field is disabled highlighting. You might use it when you're hl.fl=*.
Hl.fragsize:
The maximum number of characters returned per snippet. The default is 100. If 0, then the field will not be fragmented and the value of the entire field will be returned. This is not done in large print.
Hl.mergecontiguous:
If set to True, the snippet will merge when overlapping.
Hl.maxanalyzedchars:
Will search for the highlighted maximum character, the default value is 51200, if you want to disable, set to 1
Hl.alternatefield:
If no snippet is generated (no terms match), another field value is used as the return.
Hl.maxalternatefieldlength:
If Hl.alternatefield is enabled, it is sometimes necessary to develop a maximum character length of Alternatefield, with the default of 0 being unlimited. So a reasonable value should be for
Hl.snippets * Hl.fragsize the size of the returned results will be consistent.
Hl.formatter: An extension point that provides a replaceable formatting algorithm. The default value is simple, which is the only option available at this time. Obviously this is not enough, you can see how the highlighting element in Org.apache.solr.highlight.HtmlFormatter.java and Solrconfig.xml is configured.
Note that no matter what value is highlighted in the original text, such as the pre-existing EM tags, will not be escaped, so in some cases will cause false highlighting.
Hl.fragmenter:
This is the extensibility point for SOLR to develop the fragment algorithm. Gap is the default value. The Regex is another option that indicates that the bounds of the highlight are determined by a regular expression. This is an atypical advanced option. To know how the default settings and Fragmenters (and formatters) are configured, you can look at the highlight segment in Solrconfig.xml.
The fragmenter of the Regex has the following options:
Hl.regex.pattern: pattern of regular expressions
Hl.regex.slop: This is the factor that hl.fragsize can change to fit the regular expression. The default value is 0.6, meaning if hl.fragsize=100 then fragment size will be from 40-160.
These values can be added to the Select, can be set using the SOLRJ API, or configured in Solrconfig.xml.
Examples are as follows:
<requesthandler name= "Search" class= "SOLR. Searchhandler "default=" true ">
    <!–default values for query parameters can be specified, these would be
         Overr Idden by parameters in the request
      –>
     <lst name= "Defaults" >
       <str name= "Echoparams" > explicit</str>
       <int name= "Rows" >10</int>
       <bool name= "HL" >true</bool> 
       <str name= "Hl.fl" >title,content</str>  
       <str name= "F.content.hl.fragsize" >200</str>
       <str name= "MLT.QF" >
         id^10.0 title^10.0 content^1.0
       </str>
     </lst>
</ Requesthandler>



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.