Solr learning Summary (4) Solr query parameters, solr Parameters

Source: Internet
Author: User
Tags solr query

Solr learning Summary (4) Solr query parameters, solr Parameters

It will not be involved today. net and database operations, mainly to summarize the Solr query parameters, or that sentence, only the basic content and query syntax of solr are clearly understood, and follow-up learning about solr C # And database operations, it is a matter of course. The parameters required for solr query are listed first.


1. Basic Query

The keyword of q query. this parameter is the most important. For example, q = id: 1. The default value is q = *:*,

Fl specifies which fields are returned, separated by commas (,) or spaces. Note: The fields are case sensitive, such as fl = id, title, and sort.

Start indicates the start of the number of records returned by the start operation. It is usually used on pages. The default value is 0.

Rows specifies the maximum number of records in the returned results. The default value is 10. Use start to implement paging.

Sort by sort. For example, id desc indicates that the sorting is in descending order of "id ".

Wt (writer type) specifies the output format, including xml, json, and php.

Fq (filter query) allows you to query an optional filter. Returns the query results that meet both the fq conditions in the q query results. For example, q = id: 1 & fq = sort: [1 TO 5], find the keyword id of 1, and sort is between 1 and 5.

Default query field of df, which is generally specified by default.

Qt (query type) specifies the type to process query requests. Generally, this parameter is not required. The default value is standard.

Whether the result returned by indent is indented. It is disabled by default. It is enabled with indent = true | on. This parameter is required only for json, php, phps, and ruby output debugging.

Version: the version of the query syntax. We recommend that you do not use it. The default value is specified by the server.

 

2. Solr search Operators

":" Specifies the field to query the specified value. For example, all values are returned *:*

"?" Wildcard for any character

"*" Indicates the wildcard of Multiple Arbitrary characters (cannot be used in the retrieved item * or? Symbol)

"~" Indicates fuzzy search. For example, if the search spelling is similar to "roam", write it as roam ~ The words like foam and roams are found. roam ~ 0.8. records with a returned similarity of more than 0.8 are retrieved.

AND, | boolean operator

OR, & boolean operator

NOT ,! ,-(The exclusion operator cannot be used together with items to form a query)

The "+" operator requires that the item after the symbol "+" must exist in the corresponding domain of the document

() Is used to form a subquery.

[] Include range search, such as searching records in a certain period of time, including headers and tails, date: [201507 TO 201510]

{} Does not contain range searches. For example, records in a certain period of time cannot contain the header, tail, and date: {201507 TO 201510}

 

3. Highlight

Whether h1 is highlighted, hl = true, indicating that highlight is used

Hl. fl sets a list of highlighted fields separated by spaces or commas. To enable the highlight function of a field, you must ensure that the field is stored in the schema. If this parameter is not provided, the default field "standard handler" is highlighted and the df parameter is used. The dismax field uses the qf parameter. You can use asterisks to easily highlight all fields. If you use wildcards, enable the hl. requiredFieldMatch option.

If hl. requireFieldMatch is set to true, the query result is highlighted only when this field is specified with hl. fl. The default value is false.

Hl. usePhraseHighlighter if a query contains a phrase (enclosed in quotation marks), the phrase must be completely matched before being highlighted.

If hl. highlightMultiTerm uses wildcards and fuzzy search, the matching term with the wildcard is highlighted. The default value is false, and hl. usePhraseHighlighter must be true.

The maximum number of characters returned by hl. fragsize. The default value is 100. If it is 0, this field will not be fragmented and the value of the entire field will be returned.

 

4. Grouping

Http://wiki.apache.org/solr/SimpleFacetParameters#Facet_Fields_and_Facet_Queries

This is the official wiki of facet, which provides detailed descriptions of each facet parameter. So here we only talk about some common ones.

1. Field Facet

Facet parameter fields must be indexed

Facet = on or facet = true

Facet. field group field

Facet. prefix indicates the prefix of the Facet field.

Number of results returned by the facet. limit Facet field

Facet. offict start number and offset, which can be used with facet. limit to achieve paging effect.

The minimum count of the facet. mincount Facet field. The default value is 0.

If facet. missing is on or true, records whose Facet field values are null are counted.

Facet. sort indicates the order in which the Facet field value is returned. the format is true (count) | false (index, lex). true (count) indicates that values are sorted in ascending order of count values. false (index, lex) it indicates the order of Field Values (in the order of letters and numbers. the default value is true (count)

 

2. Date Facet

Facet The Date Field. solr provides a more convenient way to query statistics for date fields. note that the field type of Date Facet must be DateField (or its subtype ). note that when Date Facet is used, the field name, start time, end time, and time interval must be provided.

Facet. date this parameter indicates the field name for Date Facet. Like facet. field, this parameter can be set multiple times to perform Date Facet on multiple fields.

Facet. date. start time, generally in the format of "2015-12-31T23: 59: 59Z". You can also use "NOW", "YEAR", "MONTH", and so on,

Facet. date. end Time

Facet. date. gap time interval. If start is 2015-1-1 1-1, end is 2016-1-1, and gap is set to "+ 1MONTH", it indicates that the interval is 1 month, and the time interval is divided into 12 intervals.

Facet. date. hardend indicates whether to continue to the next interval in the remaining part of the time range from gap iteration to end. The value can be true | false. The default value is false.

For example, start is, end is, and gap is "+ 1MONTH". If hardend is false, the last time range is to. Otherwise, if hardend is true, the last time range is to 2015-12-21.

 


Related Article

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.