Understanding Relational Operators


Verity's relational operators enable you to search for words within specific document fields, such as the title of the document or a custom field. These operators do not rank searches by relevance. The relational operators include the following:

  • CONTAINS

  • MATCHES

  • STARTS

  • ENDS

  • SUBSTRING

  • =, <, >, <=, and >=

Table E.2 summarizes the document fields available for use with relational operators.

Table E.2. Document Fields Available for Use with Relational Operators

FIELD

EXPLANATION

CF_TITLE

The filename of the document if the collection is based on normal documents, or whatever table column you specified for TITLE if the collection is based on database data.

CF_CUSTOM1

Whatever table column you specified for CUSTOM1, if any, if your collection is based on database data.

CF_CUSTOM2

Whatever table column you specified for CUSTOM2, if any, if your collection is based on database data.

CF_KEY

The filename of the document if the collection is based on normal documents, or whatever table column you specified for KEY if the collection is based on database data. You use relational operators with this field if the user already knows the unique ID for the record he or she wanted, such as a knowledge-base article number.

CF_URL

The URL path to the document, as defined when you indexed the collection


The CONTAINS operator finds documents in which a specific field contains the exact word(s) you specify; it's similar to using the WORD operator on a specific field. If you specify more than one word, the words must appear in the correct order for the document to be considered a match. Here are some examples:

 CRITERIA="CF_TITLE <CONTAINS> smoking" CRITERIA="CF_TITLE <CONTAINS>'smoking,policy'" 

The MATCHES operator finds documents in which the entirety of a specific field is exactly what you specify. This operator looks at the field as a whole, not as individual words. A search for the words Smoking Policy in the CF_TITLE field would match only documents in which the title was literally "Smoking Policy," verbatim. This feature is probably most useful with custom fields, if the custom field holds nothing more than some type of rating, category code, or the like. Here are some examples:

 CRITERIA="CF_TITLE <MATCHES>'Smoking Policy'" CRITERIA="CF_CUSTOM1 <MATCHES> Policies" 

The STARTS operator finds documents in which a specific field starts with the characters you specify, such as this:

 CRITERIA="CF_TITLE <STARTS> smok" 

The ENDS operator finds documents in which a specific field ends with the characters you specify, such as the following:

 CRITERIA="CF_TITLE <ENDS> olicy" 

The SUBSTRING operator finds documents in which a specific field contains any portion of what you specify. Unlike CONTAINS, this operator matches incomplete words. Here is an example:

 CRITERIA="CF_TITLE <SUBSTRING> smok" 

The =, <, >, <=, and >= operators perform arithmetic comparisons on numeric and date values stored in specific fields. These are probably useful only with custom fields, if the table columns you specify for the custom fields hold only numeric or date values.

NOTE

These operators don't need angle brackets around them.


The following are some examples:

 CRITERIA="CF_CUSTOM1 = 5" CRITERIA="CF_CUSTOM2 >= 1990" CRITERIA="CF_CUSTOM2 < #DateFormat(Form.SearchDate, 'yyyy-mm-dd') 



Macromedia Coldfusion MX 7 Web Application Construction Kit
Macromedia Coldfusion MX 7 Web Application Construction Kit
ISBN: 321223675
EAN: N/A
Year: 2006
Pages: 282

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net