# FieldText Query Guidelines

- In addition to document fields, you can also apply FieldText restrictions to metafields, such as `autn_date`, `autn_database`, `autn_section`, `autn_langtype`, and `autn_language`. For example:

      FieldText=STRING{Archiv}:autn_database

  In this example, the `autn_database` metafield must contain the substring Archiv for this document to return. For example, if the `autn_database` metafield has the value Archive or Archives, this document returns.

      FieldText=WILD{eng*}:autn_langtype

  In this example, the `autn_langtype` metafield must contain a value that starts with eng (for example, englishASCII or English_UTF8) for this document to return as a result.

- You can use multiple field specifiers simultaneously by combining them with the Boolean operators `AND`, `NOT`, and `OR`. For example:

      FieldText=GREATER{6.95}:PRICE:PREIS+AND+MATCH{Brown}:AUTHOR:AUTOR

  In this example, the `PRICE` or `PREIS` field must contain a number greater than 6.95, and the `AUTHOR` or `AUTOR` field must have the value Brown, for the document to return as a result.

      FieldText=(LESS{10}:PRICE+AND+MATCH{Penguin}:PUBLISHER)+OR+(NRANGE{20,30}:PRICE+AND+MATCH{George Orwell}:AUTHOR)

  In this example, the documents must meet one of these two criteria:

  - the `PRICE` field contains a number smaller than 10, and its `PUBLISHER` field has the value Penguin.

  - the `PRICE` field contains a number between 20 and 30, and its `AUTHOR` field has the value George Orwell.

- You can use the proximity operators `BEFORE` and `AFTER` to specify the order in which certain fields must occur in a document. For example:

      FieldText=FieldText=MATCH{Penguin}:PUBLISHER BEFORE MATCH{George Orwell}:AUTHOR

  This example returns only documents where the `PUBLISHER` field contains the value Penguin earlier in the document than the `AUTHOR` field that contains the value George Orwell.

  NOTE: For a `FieldText` query to successfully compare two occurrences of the same field, you must set the `XMLFullStructure` configuration parameter to `True` in the `[Server]` section of the configuration file.

      FieldText=MATCH{George Orwell}:AUTHOR AFTER MATCH{Thomas Brown}:AUTHOR

  This example returns only documents where one occurrence of the `AUTHOR` field contains the value George Orwell later in the document than another occurrence of the `AUTHOR` field that contains the value Thomas Brown. This query returns results only if you have set `XMLFullStructure` to `True`.

- To identify the fields, use the format `/FieldName` to match root-level fields, `*/FieldName` to match all fields except root-level, or `/Path/FieldName` to match fields that the specified path points to.

  To identify XML attributes, use the format `<tag name>/_ATTR_<attribute name>`, for example,`FARM/_ATTR_ANIMAL`. You can also use Wildcards when identifying fields, for example, `/Fi*d1` or `/Field*`.

- All string matching is case insensitive, unless you set the `CaseSensitive` parameter to `True` (this parameter does not apply for `TERM`, `TERMPHRASE`, and `TERMALL`, which are always case insensitive).

  Strings can contain punctuation, except braces ({ }). You must percent-encode ampersands (`&`) in strings as `%26`. To distinguish commas within strings from separator commas, percent-encode commas twice within strings (`%252C`).

  You must not percent-encode commas that separate multiple items, and braces that start and end lists.

  For example, to match the two strings `hello,world` and `goodbye,again`:

      FieldText=MATCH{hello%252Cworld,goodbye%252Cagain}:FIELD

Related Topics

- Metadata Fields

_FT_HTML5_bannerTitle.htm