# Create a QMS Rule IDX Document

A QMS document is a text file that includes the required IDX fields, saved with the file name extension .IDX.

The table describes the fields that each QMS rule contains.

Required IDX fields for all QMS rule documents

Field | Description
--- | ---
`#DREREFERENCE` | A unique reference string to identify the rule.
`#DRETITLE` | A title to identify the rule.
`#DREFIELD QMSTYPE="N"` | The type of rule. Each rule type has a different value of `N`. See Values of QMSTYPE.
`#DREENDDOC` | The end of the rule document. Add this field after all the rule fields.

In addition to these standard fields, you must add different fields depending on the type of rule. For example, you must add fields to specify the queries that a rule applies to, and to specify how QMS must modify the query or results.

Add each additional field in the following format:

    #DREFIELD FIELDNAME="FieldValue"

where,

`FIELDNAME` | is the name of the field.
`FieldValue` | is the value that this field contains.

For example:

    #DREFIELD QMSAGENTBOOL="panda AND bear"

If you include FieldText restrictions in the `QMSFIELDTEXT` field (or another field), you must also add any fields that you use in the field restrictions as empty fields. For example:

    #DREFIELD QMSFIELDTEXT="MATCH{poodle}:BREED"
    #DREFIELD BREED=""

Related Topics

- Values of QMSTYPE

- Schedules for QMS Rules

- Example QMS Rule

- Index QMS Rules

- Query Manipulation Server Promotions

- Modify Queries

- Manipulate Results

## Values of QMSTYPE

QMS and the Promotion Agentstore use the value of the `QMSTYPE` field in each rule document to determine the type of rule that the document describes. You can use the following values for the `QMSTYPE` field.

1 | Cardinal placement (insertion) | Adds or moves a document to a specified position in a results list.
2 | Static promotion | Returns a promotion document or set of documents.
3 | Dynamic promotion | Returns the results of a query as promotion documents.
4 | Synonyms | Modifies the query to include synonymous terms.
5 | Whitelist | Removes query terms that do not match the words in the whitelist.
6 | Blacklist | Removes query terms that match the words in the blacklist.
7 | Boost rules | Expands the query `FieldText` to include extra terms.
8 | Parametric cardinal placement (parametric insertion) | Adds or moves a parametric value to a specified position in a results list.

Related Topics

- Cardinal Placement Rules

- Static Promotions

- Dynamic Promotions

- Create Synonym Rules

- Create Whitelist and Blacklist Rules

- Create Boost Rules

- Parametric Cardinal Placement Rules

## Schedules for QMS Rules

For rules with a `QMSTYPE` of `1`, `2`, or `3` (document cardinal placement or promotions), you can set a schedule to determine when the rule applies.

IDX fields for schedules

Field | Description | Content type or value
--- | --- | ---
`ALWAYSACTIVE` | Whether the rule is always active. If this field is absent or contains the value `False`, the `SCHEDULE` field must contain a valid value. | Boolean value
`SCHEDULE` | The schedule for when the rule applies. | iCalendar format schedule data

- To apply the rule all the time, add the `ALWAYSACTIVE` document field with the value `True`.
- To apply a schedule, add the `SCHEDULE` document field. This field is required if the `ALWAYSACTIVE` field is absent, or if it contains the value `False`.

You must define the schedule in iCalendar format. For details about this format, refer to:

http://datatracker.ietf.org/doc/rfc5545/

Separate the parameters and values with colons (`:`). Separate each parameter and value pair with a plus sign and two backslashes (`+\\`). For example:

    SCHEDULE="BEGIN:VCALENDAR+\\PRODID:-//Autonomy//schedule 1.0//EN+\\VERSION:2.0+\\CALSCALE:GREGORIAN+\\BEGIN:VEVENT+\\DTSTAMP:20080319T194426Z+\\SUMMARY:+\\DTSTART:20080321T220000+\\DTEND:20080322T060000+\\RRULE:FREQ=WEEKLY;UNTIL=20080530T000000Z;INTERVAL=2;BYDAY=TU,FR;WKST=SU+\\END:VEVENT+\\END:VCALENDAR+\\"

QMS automatically detects whether the iCalendar schedule is percent-encoded.

NOTE: The following iCalendar formats are not available in QMS rules:

- `"BYSECOND"`, `"BYMINUTE"`, `"BYHOUR"`, `"BYYEARDAY"`, `"BYWEEKNO"` and `"BYSETPOS"` recurrences.

- Weekday numerics, for example:

      "Last Friday of every month => [FREQ=MONTHLY;BYDAY=-1FR]"

      "Second Tuesday of every year => [FREQ=YEARLY;BYDAY=2TU]"

Related Topics

- Static Promotion Rules

- Dynamic Promotion Rules

- Cardinal Placement Rules

_FT_HTML5_bannerTitle.htm