Field Text Operators
Field Text Operators for use with Haven OnDemand text indexes.

Field Text Operators

The following field_text operators are available in Haven OnDemand.

Note: You can use field_text operators only for the listed field types. The operation fails if you attempt to use a non-optimized field type. For more information about index field types, see Index Field Types.

Note: Field names in Haven OnDemand are not case sensitive. For example, the TITLE field name is equivalent to Title or title.

You can combine multiple operators in a single query, by separating the expression with spaces. By default, Haven OnDemand combines field expressions with an implicit Boolean OR operator. You can also specify an explicit AND or NOT operator. For example:

field_text=MATCH{blue}:color AND EXISTS{}:title

For more information about how to use these operators, see How To Use Haven OnDemand Search Functionality.

Operator Matches Field Types
MATCH documents that contain one or more of the specified strings in the specified field. Numeric, Parametric, Reference
MATCHALL documents that contain all of the specified values in the specified field. Numeric, Parametric, Reference
NOTMATCH documents in which at least one instance of the specified field contain a string that is not the specified string. Numeric, Parametric, Reference
EXISTS documents that contain the specified field, irrespective of its value. any optimized type (not Index or Store Only)
EMPTY documents in which the specified field is empty or does not exist. any optimized type (not Index or Store Only)
EQUAL documents in which the specified field contains one of the specified numeric values. Numeric
GREATER documents in which the specified field contains a number that is greater than the specified number. Numeric
LESS documents in which the specified field contains a number that is less than the specified number. Numeric
NRANGE documents in which the specified field contains a number that falls within the inclusive range of two specified numbers. Numeric
NOTEQUAL documents in which at least one instance of the specified field contains a number that is not the specified number. Numeric
GTNOW documents in which a specified field contains a date that is greater than the current date. Date
LTNOW documents in which a specified field contains a date that is less than the current date. Date
RANGE documents in which a specified field contains a date that falls in the inclusive range of two specified dates. For a list of date formats that you can use with this operator, see Date Formats for Parameters. Date
DISTCARTESIAN documents where the specified fields contain an X/Y position within a specified distance from a specified point in Cartesian coordinates. Numeric
DISTSPHERICAL documents where the specified fields contain a latitude and longitude position within a specified distance from a specified location. Numeric
Operator Biases Results Field Types
BIAS according to the numerical proximity of the value in a specified field to a specified value. Numeric
BIASDATE according to the proximity of the date in a specified field to a specified date. For a list of date formats that you can use with this operator, see Date Formats for Parameters. Date
BIASDISTCARTESIAN according to the distance of the coordinates in a specified field to a specified point in Cartesian coordinates. Numeric
BIASDISTSPHERICAL according to the distance of the coordinates in a specified field to a specified point in spherical coordinates (latitude/longitude). Numeric
BIASVAL according to whether they include a specific value in the specified field. Parametric

General Field Operators

MATCH

The MATCH field specifier (case sensitive) allows you to find documents in which the entirety of a specified field contains a value that exactly matches a specified string.

Format

field_text=MATCH{yourStrings}:yourFields
yourStrings

One or more strings. A document returns only if one of these strings matches one of yourFields exactly. The matching is case-insensitive. Separate multiple strings with commas (,). There must be no space before or after a separator comma. You can match strings that contain punctuation or consist of several words, but see the following note.

Note: To distinguish query syntax punctuation from punctuation within strings, if there any curly braces or commas in the query string, escape these using HTML URL encoding. Query syntax punctuation must be left unencoded.

yourFields One or more fields. A document returns only if it contains one of these fields, and if the value in this field exactly matches one of yourStrings. Separate multiple fields with colons (:). There must be no space before or after a colon.

Examples

field_text=MATCH{0-226-10389-7}:ISBN

The ISBN field must have the value 0-226-10389-7 for the document to return as a result.

field_text=MATCH{Archive,Web,docs}:DIR:DIRECTORY

The DIR or DIRECTORY field must have the value Archive or Web or docs for the document to return as a result.

field_text=MATCH{JAMES%2C HENRY}:AUTHOR

The AUTHOR field must have the value James, Henry for the document to return a result. In the curl code to run this query from within a URL, the curly brackets and comma would appear as:

field_text=MATCH%7BJAMES%252C+HENRY%7D%3Aauthor

MATCHALL

The MATCHALL field specifier (case sensitive) allows you to find documents that contain every value of a set of strings that you specify in instances of the specified field.

Format

field_text=MATCHALL{yourstrings}:yourfield
yourStrings

One or more strings. A document returns only if all these strings have exact matches among the instances of yourField. The matching is case-insensitive. Separate multiple strings with commas (,). There must be no space before or after a separator comma. You can match strings that contain punctuation or consist of several words, but see the following note.

Note: To distinguish query syntax punctuation from punctuation within strings, if there any curly braces or commas in the query string, escape these using HTML URL encoding. Query syntax punctuation must be left unencoded.

yourFields One or more fields. A document returns only if it contains the field, and only if all yourStrings are matched at least once in the multiple instances of the field. Separate multiple fields with colons (:). There must be no space before or after a colon.

Examples

field_text=MATCHALL{Archive,Web,docs}:DIRECTORY

The DIRECTORY fields must include at least the values Archive and Web and docs for the document to return as a result.

field_text=MATCHALL{painter,sculptor}:PERSON_PROFESSION

The values painter and sculptor must all have matches in the PERSON_PROFESSION fields for the document to return as a result.

field_text=MATCHALL{Smith%2C John, Garcia%2C Joaquin}:AUTHOR

The values Smith, John and Garcia, Joaquin must both have matches in the AUTHOR fields for the document to return as a result.


NOTMATCH

The NOTMATCH field specifier (case sensitive) allows you to find documents in which at least one instance of the specified fields contains a value that does not match the specified string.

A document matches a query when it contains one or more instances of the specified field, and at least one of the instances contains a value that is not one of the specified strings. Other instances of the field can match the values.

Conversely, the document does not match the query if all instances of the specified fields contain an exact match for one of the specified strings.

Format

field_text=NOTMATCH{yourStrings}:yourFields
yourStrings

One or more strings. A document returns only if at least one instance of one of yourFields contains a value that is not an exact match for these strings. The matching is case-insensitive. Separate multiple strings with commas (,). There must be no space before or after a separator comma. You can match strings that contain punctuation or consist of several words, but see the following note.

Note: To distinguish query syntax punctuation from punctuation within strings, if there any curly braces or commas in the query string, escape these using HTML URL encoding. Query syntax punctuation must be left unencoded.

yourFields One or more fields. A document returns only if it contains one of these fields, and if the value in at least one instance of the field does not match any of yourStrings. Separate multiple fields with colons (:). There must be no space before or after a colon.
field_text=NOTMATCH{cat}:ANIMAL

At least one instance of the ANIMAL field must have a value other than cat for the document to return as a result.

For example, if a document contains only:

animal: "cat"

Then it does not return as a result. However, if the document contains:

animal: "cat",
animal: "dog"

Then it returns as a result, because one of the ANIMAL fields does not contain the value cat.

Note: To find documents in which the specified string is not present in any instance of the specified field, use the MATCH specifier with the Boolean operator NOT. For example, field_text=NOT+MATCH{cat}:ANIMAL does not return any documents that have an ANIMAL field with the value cat, even if they have other ANIMAL fields with different values.


EXISTS

The EXISTS field specifier (case sensitive) allows you to find documents that contain a specified field even if this field contains no value.

Format

field_text=EXISTS{}:yourFields
yourFields One or more fields. A document returns only if it contains one of these fields (even if the field is empty). Separate multiple fields with colons (:). There must be no space before or after a colon.

Example

field_text=EXISTS{}:ID

A document must contain an ID field to return.

field_text=EXISTS{}:ID:NAME

A document must contain an ID or NAME field (or both) to return.


EMPTY

The EMPTY field specifier (case sensitive) allows you to find documents in which a specified field does not exist or contains no value.

Format

field_text=EMPTY{}:yourFields
yourFields One or more fields. A document returns only if it does not contain any of these fields or if these fields are empty. Separate multiple fields with colons (:). There must be no space before or after a colon.

Example

field_text=EMPTY{}:ID

A document returns if it does not contain an ID field or if the ID field is empty.

field_text=EMPTY{}:ID:Name

A document returns if it does not contain an ID or Name field, or if the ID and Name field are empty.


Numeric Field Operators

The following fields find numeric values. These field specifiers are optimized for numeric fields.


EQUAL

The EQUAL field specifier (case sensitive) allows you to find documents in which a specified field contains a number that matches one of the specified numbers.

Format

field_text=EQUAL{yourNumbers}:yourFields
yourNumbers One or more numbers. A document is returned only if one of yourFields contains one of these numbers. To specify multiple numbers, separate them with commas. There must be no space before or after a comma.
yourFields One or more fields. A document is returned only if it contains one of these fields, and if this field contains one of yourNumbers. Separate multiple fields with colons (:). There must be no space before or after a colon.

Example

field_text=EQUAL{1234567890123}:ACCOUNT:KONTO

The ACCOUNT or KONTO field must contain the number 1234567890123 for the document to return.

field_text=EQUAL{3.9,4.9,7}:ID

The ID field must contain the number 3.9, 3.90, 4.9, 4.90, 7 or 7.0 for the document to return.


GREATER

The GREATER field specifier (case sensitive) allows you to find documents in which a specified field contains a number that is greater than a specified number.

Format

field_text=GREATER{yourNumber}:yourFields
yourNumber A number. A document returns only if one of yourFields contains a number that is greater than this number.
yourFields One or more fields. A document returns only if it contains one of these fields, and if the number in this field is greater than yourNumber. Separate multiple fields with colons (:). There must be no space before or after a colon.

Example

field_text=GREATER{66}:ID

The ID field must contain a number greater than 66 for the document to return.

field_text=GREATER{5.59}:PRICE:PREIS

The PRICE or PREIS field must contain a number greater than 5.59 for the document to return.


LESS

The LESS field specifier (case sensitive) allows you to find documents in which a specified field contains a number that is smaller than a specified number.

Format

field_text=LESS{yourNumber}:yourFields
yourNumber A number. A document returns only if one of yourFields contains a number that is smaller than this number.
yourFields One or more fields. A document returns only if it contains one of these fields, and if the number in this field is smaller than yourNumber. Separate multiple fields with colons (:). There must be no space before or after a colon.

Example

field_text=LESS{66}:ID

A document's ID field must contain a smaller number than 66 for this document to be returned.

field_text=LESS{5.59}:PRICE:PREIS

A document's PRICE or PREIS field must contain a smaller number than 5.59 for this document to be returned.


NRANGE

The NRANGE field specifier (case sensitive) allows you to find documents in which a specified field contains a number that falls within the inclusive range of two specified numbers.

Format

field_text=NRANGE{yourNumbers}:yourFields
yourNumbers Two numbers, separated by a comma (,). There must be no space before or after the comma. A document returns only if one of yourFields contains a number that falls within the inclusive range of the specified numbers (including decimal numbers).
yourFields One or more fields. A document returns only if it contains one of these fields, and if this field contains a number that falls within the inclusive range of yourNumbers. Separate multiple fields with colons (:). There must be no space before or after a colon.

Example

field_text=NRANGE{1,99}:CODE

The CODE field must contain a number between 1 and 99 (inclusive) for this document to return.

field_text=NRANGE{1234567890123,2345678901234}:ACCOUNT:KONTO

The ACCOUNT or KONTO field must contain a number between 1234567890123 and 2345678901234 (inclusive) for this document to return.

field_text=NRANGE{36.5,42.3}:CODE

The CODE field must contain a number between 36.5 and 42.3 (inclusive) for this document to return.


NOTEQUAL

The NOTEQUAL field specifier (case sensitive) returns documents in which at least one instance of a specified field contains a number that does NOT match the number you specify.

Format

field_text=NOTEQUAL{yourNumber}:yourFields
yourNumber A number. A document returns only if at least one instance of one of yourFields contain a number that is not yourNumber.
yourFields One or more fields. A document returns only if it contains at least one of these fields, and if at least one instance of one of these fields does not contain yourNumber. Separate multiple fields with colons (:). There must be no space before or after a colon.

Example

field_text=NOTEQUAL{1234}:ACCOUNT:KONTO

Documents must contain an ACCOUNT or KONTO field, and at least one instance of one of these fields must contain a number that is not 1234.

field_text=NOTEQUAL{7}:ID

Documents must contain an ID field, and at least one instance of this field must not contain the number 7 or 7.0.


Date Field Operators

The following fields find date values. These field specifiers are optimized for date fields.


GTNOW

The GTNOW field specifier (case sensitive) allows you to find documents in which a specified field contains a date that is later than the current date.

Format

field_text=GTNOW{}:yourFields
yourFields One or more fields. A document returns only if it contains one of these fields, and if this field contains a date that is later than the current date. Separate multiple fields with colons (:). There must be no space before or after a colon.

Example

field_text=GTNOW{}:TIME

The TIME field must contain a date and time that is greater than the current date and time for the document to return.

field_text=GTNOW{}:TIME:DATE

The TIME or DATE field must contain a date that is greater than the current date for the document to return.


LTNOW

The LTNOW field specifier (case sensitive) allows you to find documents in which a specified field contains a date that is earlier than the current date.

Format

field_text=LTNOW{}:yourFields
yourFields One or more fields. A document returns only if it contains one of these fields, and if this field contains a date that is earlier than the current date. Separate multiple fields with colons (:). There must be no space before or after a colon.

Example

field_text=LTNOW{}:TIME

The TIME field must contain a date and time that is earlier than the current date and time for the document to return.

field_text=LTNOW{}:TIME:DATE

The TIME or DATE field must contain a date that is earlier than the current date.


RANGE

The RANGE field specifier (case sensitive) allows you to find documents in which a specified field contains a date that falls in the inclusive range of two dates specified by you.

Format

field_text=RANGE{yourDates}:yourFields
yourDates Two dates, separated by a comma (,). There must be no space before or after the comma. For a list of date formats that you can use, see Date Formats for Parameters. A document returns only if one of yourFields contains a date that falls within the inclusive time span specified by the specified dates.
yourFields One or more fields. A document returns only if it contains one of these fields, and if this field contains a date that falls within the inclusive range of yourDates. Separate multiple fields with colons (:). There must be no space before or after a colon.

Example

field_text=RANGE{01/01/90,1/1/01}:DATE

A document's DATE field must contain a date between 01/01/1990 and 1/1/2001 for this document to be returned.

field_text=RANGE{01/01/02,01/01/2003}:DATE:MODIFIED_DATE

A document's DATE or MODIFIED_DATE field must contain a date between 01/01/2002 and 01/01/2003 for this document to be returned.

field_text=RANGE{-14,-7}:DATE

A document's DATE field must contain a date 14 to 7 days before the current date for this document to be returned.

field_text=RANGE{0,1}:DATE

A document's DATE field must contain today's or tomorrow's date (which is possible, for example, if the document originates from a different time zone or if the field contains an expiry date) for this document to be returned.

field_text=RANGE{01/01/99,.}:DATE:MODIFIED_DATE

A document's DATE or MODIFIED_DATE field can contain any date after 01/01/1999 for this document to be returned.

field_text=RANGE{.,10/10/04}:DATE

A document's DATE field can contain any date before 10/10/2004 for this document to be returned.

field_text=RANGE{-172800s,-1}:DATE

A document's DATE field must contain a time between 48 and 24 hours ago.

field_text=RANGE{198765e,.}:DATE

A document's DATE field can contain any date after 198765 seconds of Unix epoch time for this document to be returned.


Distance Operators

The following fields find location values. These field specifiers are optimized for numeric fields.


DISTCARTESIAN

The DISTCARTESIAN field specifier allows you to find documents whose X/Y position is within a specified distance from a specified point.

Format

field_text=DISTCARTESIAN{coordX,coordY,dist}:X:Y
coordX The specified X coordinate.
coordY The specified Y coordinate.
dist The distance in kilometers from the specified X/Y coordinates.
X The document field containing the X coordinate.
Y The document field containing the Y coordinate.

You must specify two fields, in the order X:Y.

Example

field_text=DISTCARTESIAN{10,11,5}:X:Y

This example matches all documents whose (X,Y) position is within a distance of 5 units of the point (10,11).


DISTSPHERICAL

The DISTSPHERICAL field specifier allows you to find documents in which the values of the LATFIELD and LONGFIELD fields (latitude and longitude, respectively) are within a specified distance from a specified point.

Format

field_text=DISTSPHERICAL{lat,long,dist}:LATFIELD:LONGFIELD
lat The specified latitude. Specify latitude positions south of the equator as negative.
long The specified longitude. Specify longitude positions west of the Greenwich Meridian as negative.
dist The distance in kilometers from the specified latitude and longitude.
LATFIELD The document field containing the latitude.
LONGFIELD The document field containing the longitude.

You must specify two fields, in the order latitude:longitude.

Example

field_text=DISTSPHERICAL{37.75,-122.4,20}:LAT:LONG

This example matches all documents whose position is within a 20 kilometer radius of San Francisco (37.75N,122.4W). The latitude and longitude position of a document in this example is contained in the fields LAT and LONG, respectively.


Bias Field Operators

The following field operators bias results where the specified field contains a value close to the specified value.


BIAS

The BIAS field specifier (case sensitive) allows you to bias the score of results at query time according to the numerical proximity of the specified field to a given value.

This field specifier is optimized for numeric fields.

Format

field_text=BIAS{optimum,range,percentage}:yourFields
optimum The value that yourFields must contain to increase or decrease the weight by the maximum percentage.
range A positive number that determines the range of the specified optimum value. If the specified field contains a value that is in the range of (optimum - range) to (optimum + range), the weight is increased or decreased according to the specified percentage.
percentage A percentage in the range 100 to -100. If the value of the specified field is within the specified range, the score of the result is increased or decreased according to how close the value is to the specified optimum.
yourFields One or more fields. A document has its score boosted if it contains one of these fields, and if this field contains a number within the specified range of the optimum value. Separate multiple fields with colons (:). There must be no space before or after a colon.

Example

field_text=BIAS{100,50,10}:*/PRICE

A document whose PRICE field value is within the range 50 either side of 100 has its weight increased on a linear scale from 10% if the price is 100, to 0% if the price is 50 or 150.

field_text=BIAS{100,50,-10}:*/PRICE

A document whose PRICE field value is within the range 50 either side of 100 has its weight decreased on a linear scale from -10% if the price is 100, to 0% if the price is 50 or 150.

field_text=BIAS{1103918400,259200,25}:AUTN_DATE

A document whose AUTN_DATE field value is within the range 259200 either side of 1103918400 has its weight increased on a linear scale from 25% if the price is 1103918400, to 0%, if the date is 1103659200 or 1104177600.


BIASDATE

The BIASDATE field specifier (case sensitive) allows you to boost the score of result documents by a specified percentage, based on how close the date in a specified field is to a specified date.

This field specifier is optimized for date fields.

Format

field_text=BIASDATE{optimumDate,range,percentage}:yourFields
optimumDate The date that the specified field must contain to increase or decrease the weight by the maximum percentage. For a list of date formats that you can use, see Date Formats for Parameters.
range A positive value that defines the range, in seconds, of the specified optimumDate. If yourFields contain a value in the range (optimum - range) to (optimum + range), the weight is increased or decreased according to the specified percentage.
percentage A percentage in the range 100 to -100. If the value of yourFields is in the specified range, the score of the result is increased or decreased according to how close the value is to the specified optimum.
yourFields One or more fields. A document has its score boosted if it contains one of these fields, and if this field contains a date that falls within the specified range of the optimum date. Separate multiple fields with colons (:). There must be no space before or after a colon.

Example

field_text=BIASDATE{01/12/2008,864000,10}:DATE

A document whose DATE field value is within a range of 10 days (864000 seconds) either side of 1/12/2008 has its weight increased on a linear scale from 10% if the date is 1/12/2008, to 0% if the date is 20/11/2008 or 11/12/2008.

field_text=BIASDATE{01/12/2008,86400,-10}:DATE

A document whose DATE field value is within a range of 10 days (864000 seconds) either side of 1/12/2008 has its weight decreased on a linear scale from -10% if the date is 1/12/2008, to 0% if the date is 20/11/2008 or 11/12/2008.


BIASDISTCARTESIAN

The BIASDISTCARTESIAN field specifier allows you to boost the score of any document according to its distance from a specified point using Cartesian coordinates (X/Y).

Format

field_text=BIASDISTCARTESIAN{coordX,coordY,range,maxboost}:X:Y
coordX The specified X coordinate.
coordY The specified Y coordinate.
range The distance in kilometers from the specified coordinates.
maxboost The maximum percentage to boost the result.
X The document field containing the X coordinate.
Y The document field containing the Y coordinate.

You must specify two fields in the order X:Y. The fields must be numeric fields.

Example

field_text=BIASDISTCARTESIAN{10,11,5,7}:X:Y

In this example, all documents whose (X/Y) position is within a distance of 5 units of the point (10,11) are given a relevance boost. The maximum boost of 7% is given to documents at the given point. The boost decreases linearly down to 0 boost at 5 units.


BIASDISTSPHERICAL

The BIASDISTSPHERICAL field specifier allows you to boost the score of any document according to its distance from a specified point using spherical coordinates (latitude/longitude).

Format

field_text=BIASDISTSPHERICAL{lat,long,range,maxboost}:LATFIELD:LONGFIELD
lat The specified latitude. Specify latitude positions south of the equator as negative.
long The specified longitude. Specify longitude positions west of the Greenwich Meridian as negative.
range The distance in kilometers from the specified latitude and longitude.
maxboost The maximum percentage to boost the result.
LATFIELD The document field containing the latitude.
LONGFIELD The document field containing the longitude.

You must specify two fields in the order latitude:longitude. The fields must be numeric fields.

Example

field_text=BIASDISTSPHERICAL{52.2,0.1,100,7}:LAT:LON

In this example, all documents within 100 kilometers of the point (lat,lon)=(52.2,0.1) are given a relevance boost. The maximum boost of 7% is given to documents at the given point. The boost decreases linearly down to 0 boost at 100 kilometers.

BIASVAL

The BIASVAL field specifier allows you to bias the score of result documents by a specified percentage, based on whether they include a specific value in the specified field.

Format

field_text=BIASVAL{fieldValue,percentBoost}:fieldName
fieldValue The value that the specified field must contain to increase or decrease the weight by the percentBoost.
percentBoost A percentage in the range -100 to 100. The percentage (positive or negative) by which to boost the relevance of documents that have the value fieldValue in the field fieldName. (The boosted relevance score cannot be greater than 100% or less than -100%.)
fieldName The name of the field that must be present (and must contain the proper value) for the document relevance to be boosted.

Example

field_text=BIASVAL{animals,10}:WIKIPEDIA_CATEGORY

A document whose WIKIPEDIA_CATEGORY field value is animals has its weighting increased by 10% (although the weighting cannot go over 100%).

field_text=BIASVAL{animals,10}:WIKIPEDIA_CATEGORY+BIASVAL{hunting,-10}:WIKIPEDIA_CATEGORY

A document whose WIKIPEDIA_CATEGORY field value is animals has its weighting increased by 10%, and a document whose WIKIPEDIA_CATEGORY field value is hunting has its weighting decreased by 10%. This example shows that biases can be negative as well as positive, and that you can include more than one set of options with the operator.