Query rule patterns consist of a sequence of elements and operators that are matched against the end-user’s search input. A text pattern consists of one or more elements; all elements must match in order for the whole pattern to match. A single element might match multiple index terms. When a match is found, the query rule actions modify the query behavior as specified in the rule.

Rule syntax is described in the table following this procedure.

To add a new query rule:

The table that follows describes the pattern elements and their syntax.

Pattern Element

Description

Simple index term element

The most basic pattern element is a simple index term, expressed as just the alphabetic string of the term, such as sell. ATG Search performs morphological analysis when loading the text patterns, so the index term of the string is used, rather than the literal string.

Example: Simple element selling is interpreted as the index term sell, which matches any form of sell, such as selling, sold, and sells.

Literal term element

To match an exact form of a term, enclose the alphabetic string of the form in double-quotes. This restricts the index term to matching the morphological information in the element.

Example: The element "selling" only matches selling.

Number term element

An element consisting of numbers is treated in the same was as a simple index term element. Typically, numbers don’t have morphological forms, except some plurals (such as 1980s) and ordinals (10th). To restrict the number element to match only the literal number, enclose the element in double-quotes, just like the literal term element.

Expanded index term element

The simple index term element only matches morphological forms of itself. To expand the pattern to match any of the term’s thesaurus entries as well, enclose it in percent characters, such as %sell%.

When this syntax is used, the element matches any form of the term, plus any of the terms listed in its thesaurus entries. The element can be limited to thesaurus entries for a particular part of speech by appending it after the term.

Examples: %sell:verb% or %charge:noun%.

Wild card elements

Text patterns can contain wild cards. The results are similar to the expanded term element, except the expansion does not use the thesaurus.

For example, the element install* expands to any index term that begins with install.

Negative elements

Elements marked with the negative operator (!), such as !buy or !"buying" require that the statement does not include these terms in order for the pattern to match.

Note: You cannot create a rule with only negative elements; for instance, you cannot specify “!shoes” as the pattern, since that would require Search to match on every other imaginable search term.

Element sequences

A text pattern can consist of more than one element. Multiple elements that appear in the same pattern with intervening white space create a Boolean AND operator, such as sell stock. This pattern matches the elements in any order (either sell stock or stock sell) but requires them to be adjacent.

Element order operator

To stipulate that one element must precede another in order for the pattern to match a statement, use the order operator (-) between the elements, such as sell – stock. This operator only affects the two surrounding elements. Preceding white space is required to distinguish the operator from a normal hyphen. For example, F-14 would not be considered the order operator.

Element distance operator

By default, two adjacent elements in a pattern are required to be adjacent in the matching statement. To adjust the distance that is allowed to appear between the elements, a period is used. This operator can take the following forms:

. – a single period means one intervening term is allowed between the elements.

.. – two periods mean two intervening term are allowed between the elements.

… – three periods mean three intervening terms are allowed between the elements; same as .3; and so on, with more periods.

.N – a single period followed by an integer means N intervening terms are allowed.

.* -- a single period followed by an asterisk means infinite intervening terms are allowed.

Note that white-space is required before and after any of these operators.

Element order and distance operators

Text patterns can combine the order and distance operators to require that the elements must be in order and within the denoted distance. The operators can be added in either order, but both require preceding white space.

Example: sell - . stock or sell . – stock..

Element macros

Users can define macros that expand to an OR of terms when referenced. The syntax of a macro reference is $name. For example, the user might define a macro called StockAction as the terms sell, buy, purchase, and trade. The text patterns can now reference $StockAction, which expands to those four terms and matches any form of any of those terms.

Query rules have actions that execute and modify the query behavior in some way. The actions are expressed in a command argument notation action,arg1,arg2,…,argN. Most actions refer to patterns, but a few act independently. The action types and their argument structures are described in the table that follows.

Action

Syntax

Argument Description

Example

Add additional terms to the query

add,term,term,…

term—Strings representing any index term. If the term is a morphological form, it is analyzed and converted to its index term. The action makes no reference to the pattern.

The following action adds the term help to the query terms:

add,help

Remove terms from the query

delete,refterm,refterm,…

refterm—References to index term elements in the query patterns, using the same string as in the pattern. A refterm argument that can not be found as an element is ignored.

The following action deletes the term system from a query that matches the given pattern:

customer .* support .* system

delete,system

Change the weight of terms in the query

weight,value,refterm,refterm,…

value—A non-negative integer ranging from 0 to 100.

refterm—Reference to index term elements of the query patterns, using the same string as in the pattern. A refterm argument that can not be found as an element is ignored.

The following action sets the weight of the term floppy to 100 in a query that matches the given pattern:

floppy disk .* error

weight,100,floppy

Add additional negative (!) terms to the query

not,term,term,…

term–Strings representing any index term. If the term is a morphological form, it is analyzed and converted to its index term.

The following action adds a negated term !fee to a query term vector:

not,fee

Add additional required (+) terms to the query

addreq,term,term,…

term–Strings representing any index term. If the term is a morphological form, it is analyzed and converted to its index term.

The following action adds a required term +procedure to the query term vector:

addreq,procedure

Add additional negative (!!) terms to the query

notdoc,term,term,…

term–Strings representing any index term. If the term is a morphological form, it is analyzed and converted to its index term.

The following action adds a negated term !!sony to the query term vector:

notdoc,sony

Add additional required (++) terms to the query

addreqdoc,term,term,…

term–Strings representing any index term. If the term is a morphological form, it is analyzed and converted to its index term.

The following action adds a required term ++dell to the query term vector:

addreqdoc,dell

Make a query term required (+) in the statement results

require,refterm,refterm,…

refterm–A reference to index term elements of the query patterns, using the same string as in the pattern. A refterm argument that can not be found as an element is ignored.

The following action makes the term floppy required in queries that match the given pattern:

floppy – disk

require,floppy

Make a query term required (++) in the index item (document) results

requiredoc,refterm,refterm,…

refterm—Index term elements of the query patterns, using the same string as in the pattern. A refterm argument that can not be found as an element is ignored.

The following action makes the term insurance required in document in queries that match the given pattern:

insurance .* liability

requiredoc,insurance

Make a query term have no term expansions

noexpand,refterm,refterm,…

refterm–A reference to index term elements of the query patterns, using the same string as in the pattern. A refterm argument that can not be found as an element is ignored.

The following action removes the expansions for the term charge in queries that match the given pattern:

battery .* charge

noexpand,charge

Change the expansion of a query

expand,refterm,term,term,…

refterm–A reference to a simple index term element of the query patterns, using the same string as in the pattern. A refterm argument that can not be found as an element is ignored.

term–Forms of any index term, reduced by morphological analysis.

The following action changes the expansion of the term book in queries that match the given pattern:

savings – book

expand,book,account,passbook

Add to the expansion of a query term

addexpand,refterm,term,term,…

refterm–A reference to a simple index term element of the query patterns, using the same string as in the pattern. A refterm argument that can not be found as an element is ignored.

term–Forms of any index term, reduced by morphological analysis.

The following action adds the expansion account to the term book in queries that match the following pattern:

savings – book

addexpand,book,account

Remove terms from the expansion of a query term

delexpand,refterm,term,term,…

refterm–A reference to a simple index term element of the query patterns, using the same string as in the pattern. A refterm argument that can not be found as an element is ignored.

term–Forms of any index term, reduced by morphological analysis.

The following action deletes the expansion human from the term person for queries that match the given pattern:

sales – person

delexpand,person,human

Make a query term match literally

literal,refterm,refterm,…

refterm–A reference to index term elements of the query patterns, using the same string as in the pattern. A refterm argument that can not be found as an element is ignored.

The following action makes the term plan double-quoted in queries that match the given pattern:

savings – plan

literal,plan

Make a sequence of query terms match literally (in double-quotes)

phrase,refterm,refterm,…

refterm—A reference to sequential index term elements of the query patterns, using the same string as in the pattern. A refterm argument that can not be found as an element is ignored.

The following action makes the phrase savings plan double-quoted in queries that match the given pattern:

savings – plan

phrase,savings,plan

Make a sequence of query terms match in order and within an adjacency distance constraint

sequence,adjacency,refterm,refterm,…

adjacency–The distance permitted between the terms of the sequence, where 0 means adjacent, 1 means one intervening term, and so on.

refterm–A reference to sequential index term elements of the query patterns, using the same string as in the pattern. A refterm argument that can not be found as an element is ignored.

The following action makes the sequence savings plan with adjacency 1 in queries that match the given pattern:

savings – plan

sequence,1,savings,plan

Make a sequence of query terms match within an adjacency distance constraint

adjacency,adjacency,refterm,refterm,…

adjacency–The distance permitted between the terms of the sequence, where 0 means adjacent, 1 means one intervening term, and so on.

refterm—A reference to sequential index term elements of the query patterns, using the same string as in the pattern. A refterm argument that can not be found as an element is ignored.

The following action makes the terms savings plan have adjacency 2 in queries that match the given pattern:

savings – plan

adjacency,2,savings,plan

Add a document set constraint to the current query constraints

docset,docset,docset,…

docset–A valid document set. A docset argument that is invalid is ignored. If more than one docset argument is provided, a Boolean OR of the document set constraints is added. If the current query already has constraints, these added constraints are joined with a Boolean AND.

The following action adds an OR of document sets as a constraint for the current query:

docset,/Topics/Products/Sony,/Topics/Products/Panasonic

Add a document URL constraint to the current query constraints

doc,url,url,…

url—A reference to a valid index item. A url argument that is invalid is ignored. If more than one url argument is provided, a Boolean OR of the document constraints is added. If the current query already has constraints, these added constraints are joined with a Boolean AND.

The following action adds an OR of two URLs as a constraint for the current query:

doc,http://www.mycorp.com/home.html,http://www.mycorp.com/help.html

Add a meta-data property constraint to the current query constraints

prop,type,name,val,val,…

type–A valid property type (enum, string, integer, float, boolean).

name—A valid property of the given type within the indexed content.

val—Values of the given property. If more than one val argument is provided, a Boolean OR of the property constraints is added. If the current query already has constraints, these added constraints are joined with a Boolean AND.

The following action adds an enum property constraint with 2 possible values:

prop,enum,status,published,internal

Add a document set preference to the current query

docsetpref,weight,docset,docset,…

weight—A positive integer between 1 and 100; represents a preference for results that are within the document set arguments. The preference values effect the relevancy computation.

docset—A reference to a valid document set. A docset argument that is invalid is ignored. If more than one docset argument is provided, a Boolean OR of the document set preferences is added.

The following action adds a document set preference of 50 for one document set, essentially giving it 50 bonus points in the relevancy computation:

docsetpref,50,/Topics/Products/Sony

Add a document URL preference to the current query

docpref,weight,url,url,…

weight—A positive integer between 1 and 100; represents a preference for results that are within the document set arguments. The preference values effect the relevancy computation.

url—A reference to a valid index item. A url argument that is invalid is ignored. If more than one url argument is provided, a Boolean OR of the document preferences is added.

The following action adds a document preference of 60 for 1 document:

docpref,60,http://www.mycorp.com/home.html

Add a meta-data property preference to the current query

prop,weight,type,name,val,val,…

weight—A positive integer between 1 and 100; represents a preference for results that are within the document set arguments. The preference values effect the relevancy computation.

type–A valid property type (enum, string, integer, float, boolean).

name—Must be a valid property of the given type within the indexed content.

val—Values of the given property. If more than one val argument is provided, a Boolean OR of the property preferences is added

The following action adds an enum property preference of 40 with 2 possible values:

prop,40,enum,status,published,internal

Add a statement feature constraint (i.e. for fielded search) to the current query

feature,field,field,…

field–Must be valid text fields. A text field that is invalid is ignored. If more than one field argument is provided, a Boolean OR of the feature constraint is added.

The following action adds a statement feature constraint of 2 fields:

feature,role:fix,role:change

Add an arbitrary action result that will be included in the response to the current query

action,arg,arg,…

arg–Arbitrary strings which are simply returned back with the response in a comma-delimited list.

action,advisor,auto,http://www.xyz.com/foo.html

 
loading table of contents...