In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly explains "what are the solr Query parameters". The content of the explanation is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn what the solr Query parameters are.
one。 Query parameter
1. Parameters of CoreQueryParam query
1) Q: query string, required.
2) q.op: overrides the defaultOperator of schema.xml (use "AND" or "OR" operation logic when there are spaces), which is generally specified by default.
3) df: default query field, which is generally specified by default.
4) qt: query type, which specifies the Query Handler used by the query. The default is "standard".
5) wt: writer type. Specifies the query output structure format, default to "xml". Query output formats are defined in solrconfig.xml: xml, json, python, ruby, php, phps, custom.
6) echoHandler: whether to display the Query Handler name used in the query results.
7) echoParams: whether to display query parameters. None: do not display; explicit: display only query parameters; all: all, including the Query Handler parameters defined in solrconfig.xml.
8) indent-whether the returned result is indented. It is turned off by default and enabled with indent=true | on. This parameter is only necessary for debugging json,php,phps,ruby output.
9) version-the version of the query syntax, which is not recommended, and the server specifies the default value.
2. CommonQueryParameters
1) sort: sort, format: sort=+ [, +] ".
Example: (inStock desc, price asc) means "inStock" descending order, and then "price" ascending order. The default is correlation descending order.
2) start: used to define the number of starting records of the result in paging. Default is 0.
3) rows: used to define the number of records returned per page for paging definition results. Default is 10.
4) fq:filter query. Using Filter Query can make full use of Filter Query Cache and improve the retrieval performance. Function: it is also consistent with fq query in Q query matching result.
For example: q=mm&fq=date_time: [20081001 TO 20091031], find the keyword mm, and date_time is between 20081001 and 20091031.
5) fl:field list. Specifies that the result field is returned. Separated by a space "or comma", ".
6) debugQuery: sets whether the returned result displays Debug information.
7) explainOther: sets the display of other query descriptions when debugQuery=true.
8) defType: sets the query parser name.
9) timeAllowed: sets the query timeout.
10) omitHeader: sets whether to ignore the return message of the query result. The default is "false".
two。 Query syntax
1. Match all documents: *: *
two。 Mandatory, blocked, and optional queries:
1) Mandatory: (for example, only entry name containing the word make) Solr/Lucene Statement:+make, + make + up, + make + up + kiss that must be included in the query result
2) prohibited: (for example, all documents except those with word believe) Solr/Lucene Statement:+make + up-kiss 3) optional:Solr/Lucene Statement:+make + up kiss
3. Boolean operations: AND, OR, and NOT Boolean operations (must be capitalized) are similar to Mandatory, optional, and prohibited.
1) make AND up = + make + up: the operation on the left and right sides of AND is mandatory.
2) make | | up=make OR up=make up: the operation on the left and right sides of OR is optional.
3) + make + up NOT kiss = + make + up-kiss
4) the make AND up OR french AND Kiss cannot achieve the desired results because the operations on both sides of the AND are mandatory.
4. Subexpression query (subquery): you can use "()" to construct a subquery.
For ex: (make AND up) OR (french AND Kiss)
5. Restrictions that block queries in subexpression queries:
For ex:make (- up): you can only get the query results of make; use make (- up *: *) to query make or not include the results of up.
6. Multi-field fields query: query by adding semicolons to field names (fieldName:query)
For ex:entryNm:make AND entryId:3cdc86e8e0fb4da8ab17caed42f6760c
7. Wildcard query (wildCard Query):
1) wildcards? And *: "*" means to match any character; "?" Represents the location where the match occurs.
For ex:ma?* (one position after ma matches), ma??* (two positions after ma match)
2) query characters must be lowercase: + Ma + be** can search results; + Ma + Be** has no search results
3) the query speed is slow, especially the wildcard is in the first place: the main reason is that each term in the query field needs to be iterated to determine whether it matches; second, the matching term is added to the internal query, and when the number of terms reaches 1024, the query will fail.
4) the default wildcard cannot appear in the first place in Solr (you can modify QueryParser and set setAllowLeadingWildcard to true)
5) set setAllowLeadingWildcard to true.
8. Fuzzy query, similar query: not an accurate query, through the re-insertion, deletion and transformation of the query fields to achieve a higher score query solution (supported by the Levenstein Distance Algorithm algorithm).
1) General fuzzy query: for ex:make-believ~
2) threshold fuzzy query: for fuzzy query, you can set the query threshold, the threshold is the value between 0: 1, the threshold
The higher the surface similarity is, the higher the surface similarity is. For ex:make-believ~0.5 、 make-believ~0.8 、 make-believ~0.9
9. Range query (Range Query): Lucene supports range queries for numbers, dates, and even text. The ending range can use the "*" wildcard.
For ex:
1) date range (ISO-8601 time GMT): sa_type:2 AND a_begin_date: [1990-01-01T00:00:00.000Z TO 1999-12-31T24:59:99.999Z]
2) number: salary: [2000 TO *] 3) text: entryNm: [a TO a]
10. Date matching: YEAR, MONTH, DAY, DATE (synonymous with DAY) HOUR, MINUTE, SECOND, MILLISECOND, and MILLI (synonymous with MILLISECOND) can be marked as a date.
For ex:
1) r_event_date: [* TO NOW-2YEAR]: 2 years ago at this time
2) r_event_date: [* TO NOW/DAY-2YEAR]: this time on the day before 2 years ago
three。 Function query (Function Query)
A function query can grade a document using the value of the numeric field or a function of a specific value associated with the domain.
1. The method of using function query
There are three main ways to query using functions, and these three s methods are all through the solr http interface.
1) use FunctionQParserPlugin. Ie: Q = {! func} log (foo)
2) use the "_ val_" embedded method to embed in the normal solr query expression. That is, write the function query in the parameter Q, and at this time, we use "_ val_" to distinguish the function from other queries. Ie:entryNm:make & & _ val_:ord (entryNm)
3) use the bf parameter in dismax to use parameters that are explicitly queried by the function, such as bf (boost function) in dismax. Note: the parameter bf can be queried by multiple functions, separated by spaces, and can be weighted. Therefore, when we use the parameter bf, we must ensure that there are no spaces in a single function, otherwise the program may think it is two functions.
For ex:
The format of the function (Function Query Syntax) at present, function query does not support the form of function query, we have to write it into a method form, that is, sum (price). This is sum.
3. Use functions to query considerations
1) the field used for function queries must be indexed
2) Fields cannot be multi-valued (multi-value)
4. Available functions (available function)
1) constant: constants with decimal points are supported; for example: 1.5; SolrQuerySyntax:_val_:1.5
2) fieldvalue: this function will return the value of numeric field. The field must be indexd, not multiValued. The format is simple, which is the name of the domain. If there is no such value in this field, 0 will be returned.
3) ord: for a field, all its values will be arranged in dictionary order, and this function returns the ranking of the specific values you want to query in this order. This field, which must be non-multiValued, returns 0 when no value exists. For example: a particular field can only go to three values, "apple", "banana", "pear", then ord ("apple") = 1 banana ("banana") = 2 ("pear") = 3. It is important to note that the function ord () depends on the position of the value in the index, so the value of ord () changes when a document is deleted or added. When you use MultiSearcher, this value is variable.
4) rord: this function will return the inverted ranking corresponding to ord. Format: rord (myIndexedField).
5) sum: the meaning of this function is obvious. It means "and". Format: sum (xprime1), sum (xmemy), sum (sqrt (x), log (y), zjind0.5)
6) product:product (XJI YJ..) The product of multiple functions will be returned. Format: product (xmem2), product (xmemy)
7) div:div (XMague y) represents the value of x divided by y in the format: div (1Magnex), div (sum (xMagne100), max (yPhone1))
8) pow:pow represents a power value. Pow (x ^ y) = x ^ y. For example, pow (XMagol 0.5) represents the prescription pow (xMagol log (y)).
9) abs:abs (x) returns the absolute value of the expression. Format: abs (- 5), abs (x)
10) log:log (x) will return a logarithm with a cardinality of 10. Format: log (x), log (sum (xmem100))
11) Sqrt:sqrt (x) returns the square root of a number. Format: sqrt (2), sqrt (sum (xmem100))
12) Map: if x > = min, the maximum value of this function is 1, and the value decreases as x increases. For example: recip (rord (creationDate), 1mem1000 and 1000)
17) Max: max (XMagol c) will return the maximum value between a function and a constant. For example: max (myfield,0)
Thank you for your reading, the above is the content of "what are the solr Query parameters?" after the study of this article, I believe you have a deeper understanding of what the solr Query parameters have, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.