2.2.11.9 Text Restriction

The protocol server MUST interpret text restriction as one of the following:

  • NEAR restriction, which also covers single token, prefix, or synonym. The text restriction MUST match the item if the NEAR restriction matches the item;

  • Qualified or unqualified phrase or qualified token. The text restriction MUST match the item if the token or phrase matches the item;

  • Text expression enclosed in parenthesis. The text restriction MUST match the item if the enclosed expression matches the item.

  • ALL restriction. The text restriction MUST match the item if the ALL restriction matches the item.

  • ANY restriction. The text restriction MUST match the item if the ANY restriction matches the item.

  • NONE restriction. The text restriction MUST match the item if the NONE restriction matches the item.

     text-restriction = text-near-restriction
     text-restriction =/ "(" *ws text-expression *ws ")"
     text-restriction =/ text-phrase / text-qualified-phrase / text-qualified-token
     text-restriction =/ text-all-restriction
     text-restriction =/ text-any-restriction
     text-restriction =/ text-none-restriction
    

The NEAR restriction matches one or more tokens, prefixes, or synonyms that occur close to each other in the item. This restriction MUST match the item whenever all tokens, prefixes, or synonyms are found in the item with the preserved order and distance not greater than that implementation-defined value. That value MUST be greater than 1.

If there is only one token, prefix, or synonym is specified, then it MUST match the item if the item contains that single token, prefix, or synonym.

 text-near-restriction = text-syn-term
 text-near-restriction =/ text-near-restriction 1*ws near-operator 1*ws text-syn-term
 text-syn-term = text-token / text-prefix / text-synonym

The ALL restriction MUST match the item if it contains all the tokens supplied between the parentheses.

 text-all-restriction = all-operator "(" *ws 1*text-token *ws ")"

The ANY restriction MUST match the item if it contains one or more of the tokens supplied between the parentheses.<16>

 text-any-restriction = any-operator "(" *ws 1*text-token *ws ")"

The NONE restriction MUST match the item if it contains none of the tokens supplied between the parentheses.

 text-none-restriction = none-operator "(" *ws 1*text-token *ws ")"