1.7.4.1 Function Queries

Source: Internet
Author: User

1. Function Queries

function queries enable you to generate an associated score (score) using the actual values of one or more numeric fields, function queries support Dixmax,edismax, and standard query parsing.

function queries use functions that can be constants (numeric or character literals), one field, another function, and a parameter that replaces parameters. You can also use this function to modify the result ordering.

Here are three main ways to query a function:

    • Use the _val_ keyword to introduce a function query:
_val_:mynumericfield _val_: "Recip (Rord (MyField),
    • Use parameters with explicit function query types, such as the BF (boost function) parameter of the Dismax query parser. Note The BF parameter actually uses a space-delimited list of function queries.
      Q=dismax&bf= "ord (popularity) ^0.5 Recip (Rord (Price), 1,1000,1000) ^0.3"
    • Add the result of a function query as a field for a document:
      &fl=sum (x, y), Id,a,b,c,score

      Output Result:

...<Strname= "id">Foo</Str><floatname= "sum (x, y)">40</float><floatname= "Score">0.343</float>...

Only the random quick access feature is recommended for use.

1.1 ABS

Description: Returns the absolute value of the specified values or functions

Syntax Examples: ABS (x) ABS (-5)

  

1.2 and

Description: Returns True when and only if two of its operations are true

Syntax examples: and ("Blue", "Sky")

1.3 constant

Description: Specifies a floating-point value constant

Syntax Examples: 1.5 or _val_:1.5

1.4 Def

Description: Default abbreviation. Returns the value of the field, returns the specified value if the field does not exist, and generates the first value where exists () ==true.

Syntax examples: def (rating,5), Def (MyField, 1.0) equivalent to if (exists (MyField) myfield,1.0)

1.5 div

Describe:

Syntax Examples:

1.4 Def

Describe:

Syntax Examples:

1.4 Def

Describe:

Syntax Examples:

1.4 Def

Describe:

Syntax Examples:

1.4 Def

Describe:

Syntax Examples:

1.4 Def

Describe:

Syntax Examples:

1.4 Def

Describe:

Syntax Examples:

1.4 Def

Describe:

Syntax Examples:

1.4 Def

Describe:

Syntax Examples:

1.4 Def

Describe:

Syntax Examples:

1.4 Def

Describe:

Syntax Examples:

1.4 Def

Describe:

Syntax Examples:

1.4 Def

Describe:

Syntax Examples:

1.4 Def

Describe:

Syntax Examples:

1.4 Def

Describe:

Syntax Examples:

1.4 Def

Describe:

Syntax Examples:

1.7.4.1 Function Queries

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.