다음을 통해 공유


FQL Token Expressions

Applies to: SharePoint Server 2010

In this article
Wildcard Expressions
Numeric Term Expressions
Reserved Words and Special Characters

Token expressions are words, phrases, or numeric values that are matched against the index.

A text token expression can be a single word or a phrase enclosed in double quotation marks.

A numeric token expression can be a single value or a value range expression.

Wildcard Expressions

A wildcard expression indicates a single term or phrase that includes one or more of the following wildcard characters:

  • Asterisk ("*"), which indicates to match zero or more characters (not including whitespace)

  • Question mark ("?"), which indicates to match a single character (not including whitespace)

FAST Query Language (FQL) supports wildcard search for individual text managed properties and full-text indexes.

Wildcard Expression Examples

The following query expression finds items that contain the word "Shakespeare":

shak?sp*r*

The following is a list of valid uses of wildcard expressions in FQL:

  • text*

  • *text

  • *text*

  • te?t

  • *te?t

  • string("this examp*")

  • string("this *ample")

  • string("this *ampl*")

  • string("this exam?le")

  • string("thi* exam?le")

Note

The previous examples show valid FQL wildcard syntax. You should avoid using expressions that match many words in the index, such as expressions starting with a wildcard term. Such queries may be used when you query managed properties with limited amount of content, but will typically not return any results if you query a full-text index.

Wildcards cannot match whitespace characters. The following table contains examples of wildcard expressions that may not match as expected.

Table 1.Examples of wildcard expressions and how they match content

Query

What Query Does Not Match

string("this*examp*", mode="PHRASE")

string("this?example", mode="PHRASE")

"This example text shows wildcard terms"

The wildcard term does not match the whitespace.

string("Example?This", mode="PHRASE")

"Example:This is some text"

The wildcard term does not match the colon. The colon is treated as a whitespace.

Optionally, you can use the STRING parameters minexpansion and maxexpansion to specify the range of the wildcard expansion. The following expressions are equivalent.

any("prefix","prefix?","prefix??","prefix???","prefix????")

string("prefix*",maxexpansion=4)

Numeric Term Expressions

Each numeric term expression must include a property specification of a compatible index schema data type.The following table lists the numeric data types that can be used in FQL.

Table 2. Numeric data types that can be used in FQL

FQL Type

Compatible Index Schema Types

Description

Int

Integer

64 bit integer.

float

Float

Decimal

64-bit (double precision) floating point.

Datetime

Datetime

A date and time value.

The date/time support in FQL enables the same numeric operations on date/time values as on other numeric values.

Date and Time Query Expressions

FQL provides the datetime data type for date and time.

The following ISO 8601-compatible datetime formats are supported in queries:

  • YYYY-MM-DD

  • YYYY-MM-DDThh:mm:ss

  • YYYY-MM-DDThh:mm:ssZ

In these datetime formats:

  • YYYY specifies a four-digit year.

    Note

    Only four-digit years are supported.

  • MM specifies a two-digit month. For example, 01 = January.

  • DD specifies a two-digit day of the month (01 through 31).

  • T specifies the letter "T".

  • hh specifies a two-digits hour (00 through 23); A.M./P.M. indication is not allowed.

  • mm specifies a two-digit minute (00 through 59).

  • ss specifies a two-digit second (00 through 59).

All date/time values must be specified according to the UTC (Coordinated Universal Time), also known as GMT (Greenwich Mean Time) time zone. The UTC time zone identifier (a trailing "Z" character) is optional.

Reserved Words and Special Characters

The following words are reserved within FQL.

and, or, any, andnot, count, decimal, rank, near, onear, int, in32, int64, float, double, datetime, max, min, range, phrase, scope, filter, not, string, starts-with, ends-with, equals, count

If you want to express any of these words as terms in a query expression, you must enclose them in double quotation marks as shown in the following examples:

  • or("any", "and", "rank")

  • string("any and rank", mode="OR")

  • phrase(this, is, a, "phrase")

Tip

Reserved words and characters are not case-sensitive, but using lowercase characters are recommended for future compatibility.

FQL does not always require a string to be enclosed in double quotation marks. For example, and(cat, dog) is valid FQL even though cat and dog are not in double quotation marks. However, we recommend that you use double quotation marks to avoid conflicts with reserved words.

The query terms are tokenized according to your locale setting. The tokenization process removes certain special characters. Because special characters are removed, the following FQL expressions are equivalent.

and("[king]", "<queen>")

and("king", "queen")

When a query includes terms from user input or another application, use the string("<query terms>", mode="AND|OR|PHRASE") operator to avoid conflict with reserved words in the query language. You must also remove possible double quotation marks from the user-provided query.

See Also

Concepts

FAST Search Query Integration Overview

FAST Query Language (FQL) Syntax Reference

The FQL Property Specification

FAST Query Language (FQL) Operators

FQL Simple Query Language

FQL Syntax Reference (ABNF)