SOLR's Localparams study notes

Source: Internet
Author: User
Tags solr

Localparams Study notes:

Mainly from the concept, basic syntax, query when the type parameter can be short format, parameter values and parameters reverse reference these aspects:

1 Concepts

Localparams provides a way to add metadata to a parameter type. A further explanation of this parameter type is added.

Suppose we now have a query parameter that already exists:
Q=SOLR Rocks

We use Localparams to prefix the query string to provide more information to the query parser, for example, changing Lucene query parser the default action type is "and" and the default field is "title"
Q={!q.op=and DF=TITLE}SOLR Rocks


2 basic syntax

To represent a localparam, the arguments need to be enclosed in curly braces and begin with an exclamation point inside the curly braces, containing a large number of key=value pairs that are separated by spaces.
So if the original parameter is:
Foo
After applying localparams it will look like this:
{!K1=V1 K2=v2 K3=v3}foo

Since Localparams has only one parameter prefix per key value, there is no design escape operation, but a value that exists as a "key-value pair" needs to be enclosed in quotation marks or double quotation marks and internally escaped with a backslash.

Example: Q={!type=dismax qf= ' myfield Yourfield '}SOLR rocks

3 The type parameter can be short formatted when queried

If a localparams appears without a name, it will be given a default "type" name. That is, for type types, the short format is allowed, and only the parameter values are given.
So there are:
Q={!dismax QF=MYFIELD}SOLR Rocks
Equivalent to:
Q={!type=dismax QF=MYFIELD}SOLR Rocks

4 function of the special parameter V

The direct example illustrates:
Q={!dismax QF=MYFIELD}SOLR Rocks
Equivalent to
Q={!type=dismax Qf=myfield v= ' Solr Rocks '}


5 Parameter Reverse Reference

The direct example illustrates:
Q={!dismax QF=MYFIELD}SOLR Rocks
Equivalent to
Q={!type=dismax Qf=myfield v= $qq}&qq=solr Rocks













SOLR's Localparams study notes

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.