# Create Whitelist and Blacklist Rules

A whitelist is a list of words that are allowed in queries. QMS removes any words that are not in the whitelist from the query before it sends the query to IDOL Server. If a rule defines a whitelist, it must have a `QMSTYPE` field with the value `5`.

Conversely, a blacklist is a list of words that are not allowed in queries. QMS removes any words on the blacklist from the query before it sends the query to IDOL Server. If a rule defines a blacklist, it must have a `QMSTYPE` field with the value `6`.

The whitelist or blacklist rule must contain a list of words that form the list. The table shows all the fields that you must include in the IDX file for whitelist and blacklist rules.

NOTE: The `QMSAGENTBOOL` field is required for all rules. However, for blacklists and whitelists, QMS does not apply the rule according to query text matching. For these rules, you must set `QMSAGENTBOOL` and `DRECONTENT` to the title of the whitelist or blacklist.

For general queries, you activate a whitelist or blacklist rule by sending the query with the `Whitelist` or `Blacklist` parameter set to the title of the appropriate rule. QMS also uses the values of the `DRECONTENT`, `QMSAGENTBOOL`, and `QMSFIELDTEXT` fields for explicit profiling.

Required IDX fields for whitelist and blacklist rules

Field | Description | Content type or value
--- | --- | ---
`#DREREFERENCE` | The reference for the rule. | String
`#DRETITLE` | The title of the rule. | String
`QMSTYPE` | The type of the QMS rule. | `5` (whitelist rule) `6` (blacklist rule)
`QMSAGENTBOOL` | The AgentBoolean expression used to match the original query text. For blacklist and whitelist rules, you set this field to the title of the whitelist or blacklist. | Set this field to the name of the whitelist or blacklist rule.
`QMSFIELDTEXT` | The FieldText rules to match against. This field is used only for explicit profiling. | FieldText expression
`KEYWORDS` | The set of words that form the list. | Comma-separated list of words. Percent-encode spaces and punctuation in the words.
`#DRECONTENT` | The content to match the Boolean field. For blacklist and whitelist rules, you set this field to the title of the whitelist or blacklist. | Set this field to the name of the whitelist or blacklist rule.
`Referenced Fields` | All fields that the `QMSFIELDTEXT` field references must be present in the rule as a field with blank content. | Empty field

Related Topics

- Example Blacklist Rule
- Example Whitelist Rule

_FT_HTML5_bannerTitle.htm