다음을 통해 공유


FQL Simple Query Language

Applies to: SharePoint Server 2010

The Simple Query Language support enables you to create search boxes with simple operators, such as those found on common search engines on the Web. This includes support for mixing words or phrases and mixing AND, OR, and NOT in a simpler way than by using the more formal FAST Query Language (FQL) syntax.

This format is supported within the syntax of the STRING operator, as follows.

string("<simple query language expression>", mode="simpleall")
string("<simple query language expression>", mode="simpleany")
  • simpleall: A logical AND is applied between the terms and/or phrases within the <simple query language expression>, unless the terms are preceded with a minus ("-") character.

  • simpleany: A logical OR is applied between the terms and/or phrases within the <simple query language expression>, unless the terms are preceded with a plus ("+") or minus ("-") character.

The terms or phrases in the <simple query language expression> must be separated with white space.

If the <simple query language expression> contains a phrase, the double quotation marks must be escaped with the backslash ("\") character. For example, if a user enters the query "king lear" shakespeare, the resulting FQL STRING operator must be formatted as follows:

string("\"king lear\" shakespeare", mode="simpleall|simpleany")

Note

The FQL simple query language does not support all the options of the SharePoint Keyword Syntax used in the SharePoint query Web Parts. To expose the same query syntax in a custom application, review the options described in Supported Query Languages.

The length of FAST Query Language queries is limited to 2,048 characters.

SIMPLEALL Mode

SIMPLEALL mode (mode="simpleall") means that all query terms or phrases (separated by white space) have to be matched in the returned documents. This equals a logical AND between the terms or phrases. This default matching mode can be overridden by using the prefix plus ("+") or minus ("-"), as described in the following table.

Prefix

Description

+

This prefix is allowed, but ignored.

The following expressions are equivalent and return all documents that include both "goethe" and "faust":

+faust +goethe

+faust goethe

faust +goethe

faust goethe

-

This prefix applies a logical NOT to the following term.

The following expression returns all documents that include "goethe" and "faust", but not if these documents also include "marlowe":

goethe faust -marlowe

Note

Spaces are not allowed between the "+" or "-" character and the following term or phrase.

SIMPLEANY Mode

SIMPLEANY mode (mode="simpleany") means that at least one of the query terms or phrases (separated by white space) has to be matched in the returned documents. This default matching mode can be overridden by using "+" or "-" as described in the following table.

Using this mode corresponds to using the OR Boolean query parameter. In mode="simpleany" one of the query terms or phrases has to be matched if no + or - operators are applied (only one or more terms delimited by whitespace.)

Prefix

Description

+

The term or phrase following the "+" must be matched (logical AND).

Examples

The following expression returns all documents that include "goethe" and "faust":

+faust +goethe

The following expression returns all documents that include "faust". The documents that also include "goethe" will get increased dynamic rank and appear higher in the result set:

+faust goethe

The following expression returns all documents that include "shakespeare". The documents that also include the phrase "king lear" will get increased dynamic rank and appear higher in the result set:

\"king lear\" +shakespeare

-

This prefix applies a logical NOT to the following term.

Examples

The following expression returns all documents that include "goethe" AND "faust", but NOT if these documents also include "marlowe":

+goethe +faust -marlowe

The following expression returns all documents that include "goethe", but not if these documents also include "marlowe". The documents that also include "faust" will get increased dynamic rank and therefore appear higher in the result set:

+goethe faust -marlowe

The following expression is a special case that will be evaluated by using an approximation:

faust -marlowe

It will be evaluated as follows:

andnot(faust, marlowe)

Note

Spaces are not allowed between the "+" or "-" character and the following term or phrase.

See Also

Concepts

FAST Search Query Integration Overview

FAST Query Language (FQL) Syntax Reference

The FQL Property Specification

FQL Token Expressions

FAST Query Language (FQL) Operators

FQL Syntax Reference (ABNF)