SOLR important points of knowledge

Source: Internet
Author: User
Tags solr solr query

1 SOLR Query parameter description

Common

1) Q-the query string, which is required. 2) FL-specifies that the contents of those fields be returned, separated by commas or spaces. 3Start-Returns the offset position of the first record in the full found result,0Start, general paging is used. 4) Rows-Specifies the maximum number of records to return, with start for paging. 5) 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. Note: the sort field can only be used for numeric types such as:int, dobuble, etc. ..6WT-(writer type) specifies the output format, which can have XML, JSON, PHP, Phps, back SOLR1.3added, be notified by us, because the default is not turned on. 7) Fq-(filter query), the effect: in the Q query conforms to the results of the FQ query is also consistent, for example: q=mm&fq=date_time:[20081001To20091031], find the keyword mm, and date_time is20081001To20091031Between the. Official Document: http://wiki.apache.org/solr/commonqueryparameters#head-6522ef80f22d0e50d2f12ec487758577506d6002

2) infrequently used

1) q.op-Overwrite Schema.xml's Defaultoperator (with "and " or "or  " with a space) " operational logic", typically specified by default 2) DF-The default query field, typically specified by default 3) QT- (query type) specifies that type to handle query requests, Generally not specified, default is standard.  3) Other 1) Indent-Returns whether the result is indented, closed by default, with indent=true| On , the general debug Json,php,phps,ruby output is necessary to use this parameter.  2) version-query syntax versions, it is recommended not to use it, by the server to specify the default value.

2 SOLR Search Operators

1. ":" Specifies the field to check for the specified value, such as returning all values *:*2. “ ?"represents a single arbitrary character of a wildcard3. "*" denotes a wildcard of multiple arbitrary characters (cannot start with the retrieved item * or?).symbols)4. "~" means a fuzzy search, such as a search for an entry with a spelling similar to "roam": roam~ will find words like foam and roams; roam~0.8, retrieving records that return a similarity of more than 0.8. 5. Proximity search, such as retrieving 10 words of "Apache" and "Jakarta", "Jakarta Apache" ~Ten6. "^" To control relevance search, such as retrieving Jakarta Apache, and hoping to make "Jakarta" more relevant, then add "^" symbol and increment value, that is jakarta^4Apache7. Boolean operator and, | |8. Boolean operator or, &&9. Boolean operator not,!、-(the exclusion operator cannot be a singleton query with the item usage)Ten. "+" exists operator, requires symbol "+The item must exist in the appropriate domain of the document One. () used to form a subquery A. [] contains a range of searches, such as retrieving a time period record, including the Kinsoku, date:[200707To200710] -. {} does not contain range retrievals, such as retrieving a time period record, not including the Kinsoku date:{200707To200710Note: The Range retrieval field applies only to: String,int, dobule,date cannot be used in a long type field -. \ Escape operator, special characters include +-&& | | ! () {} [] ^ "~ *?: \

3 Field Increase weight

In many cases, we may need to increase the weight of a field to properly display the search results. For example: There is a schma, there are three fields: Chapterid, title, content. We hope that if a keyword matches in the title, it will be shown first, and in the content, it will be placed behind the search results. Of course, if the two match, of course there is nothing to say. See how it's done in SOLR. Title: (test1 test2)^4  content: (test1 test2) add weights to the Title field, first match, about ^ after the number 4, after I test, The best value should be that there are N fields written n+1, of course, I hope you can better test!




SOLR important points of knowledge

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.