Skip to main content

We've Moved!

Product Documentation has moved to docs.hitachivantara.com
Hitachi Vantara Knowledge

Conditional statements

You can surround one or more stages in a processing pipeline with a conditional statement. When you do this, documents that meet the condition are sent through to the stages within the statement. All other documents bypass the conditional statement entirely.

You can nest conditional statements within other conditional statements, up to four levels deep.

Example

This conditional statement allows certain documents to pass through to the Drop Documents stage. Documents that do not meet this criteria bypass the Drop Documents stage and continue on to the next stage in the pipeline.

GUID-668DAA44-C20B-4DA3-96FD-1ACB0D26941D-low.png
Adding conditional statements to processing pipeline

For information, see Adding conditional statements to a pipeline.

Conditional statement contentsEach conditional statement includes one or more rules. You can use the AND, OR, and NOT operators to combine multiple rules in conditional statement.

Each rule contains:

  • The name of a field or stream that appears in a document.
  • A comparator, the method by which the system should compare the field or value you specify against the fields or values in documents passing through the pipeline.

    The value part of the conditional statement can be used to reference the value of a field using the ${field} syntax. For example, if you were to compare field1 to field2, the conditional will look like field1 greater_than ${field2}.

  • A value for the metadata field. Some comparators, such as is_null or field_exists, do not need a value specified.

    If you are using the in_list or not_in_list comparators, specify a comma-separated list of values

List of Comparators
ComparatorNegative versionDescription
equalsnot_equal

Verifies whether a document's value for a field is equal to the value you specified.

For example, a document with the field value pair softwareVersion: 2.0satisfies the conditional statement if softwareVersion equals 2.

Both the equals and not_equal comparators are case sensitive.

The values compared must be of compatible types. For example, a document failure occurs if this comparator tries to compare an integer (for example, 3) to a string (for example, three).

lexically_equallexically_not_equal

Verifies whether a document's value for a field is lexically equal to the value you specified.

Two values are lexically equal if they share the same set of characters, in the same order, and with the same number of occurrences of each character.

Both the lexically_equal and lexically_not_equal comparators are case sensitive.

equals_ignore_casenot_equals_ignore_caseSame as lexically_equal and lexically_not_equal, except these comparators are not case sensitive.
field_existsfield_does_not_existVerifies whether the specified field exists in a document.
stream_existsstream_does_not_existVerifies whether the specified content stream exists in a document.
containsnot_contains

Verifies whether the value you specify appears anywhere in the applicable document field value.

For example, this conditional rule:

HCI_display contains doc

Will match any of these document field/value pairs:

HCI_displayName: presentationNotes.doc
HCI_displayName: presentationNotes.docx
HCI_diaplayName: document2.txt

Both the contains and not_contains comparators are case sensitive.

contains_ignore_casenot_contains_ignore_caseSame as contains and not_contains, except these comparators are not case sensitive.
in_listnot_in_listVerifies whether a document's value for a field exactly matches any value in the list of values that you specified. With this comparator, you specify a comma-separated list of values.
less_thanN/A

For numerical values, verifies whether a document's value for a field is less than the value you specified.

The values compared must be of compatible types. For example, a document failure occurs if this comparator tries to compare an integer (for example, 3) to a string (for example, three).

lexically_less_thanN/A

Verifies whether a document's value for a field is lexically less than the value you specified.

For example, 20 is lexically less than 3 because the first character, 2, precedes 3 in numerical order.

less_or_equalsN/A

For numerical values, verifies whether a document's value for a field is less than or equal to the value you specified.

The values compared must be of compatible types. For example, a document failure occurs if this comparator tries to compare an integer (for example, 3) to a string (for example, three).

lexically_less_or_equalsN/AVerifies whether a document's value for a field is lexically less than or equal to the value you specified.
greater_thanN/A

For numerical values, verifies whether a document's value for a field is greater than the value you specified.

The values compared must be of compatible types. For example, a document failure occurs if this comparator tries to compare an integer (for example, 3) to a string (for example, three).

lexically_greater_thanN/A

Verifies whether a document's value for a field is lexically greater than the value you specified.

For example, 3 is lexically greater than 20 because 3 precedes 2 in numerical order.

greater_or_equalsN/A

For numerical values, verifies whether a document's value for a field is greater than or equal to the value you specified.

The values compared must be of compatible types. For example, a document failure occurs if this comparator tries to compare an integer (for example, 3) to a string (for example, three).

lexically_greater_or_equalsN/AVerifies whether a document's value for a field is lexically greater than or equal to the value you specified.
begins_withnot_begins_withVerifies whether a document's value for a field begins with the string of text you specify.
ends_withnot_ends_withVerifies whether a document's value for a field ends with the string of text you specify.
is_emptyis_not_emptyVerifies whether the specified field is empty, that is, has no value.
is_nullis_not_nullVerifies whether the specified field has a value of null.
Comparing dates

You can also use the ${NOW} field as a value when writing a conditional statement. This field compares an expression to a date and time relative to the execution of a pipeline using Solr date math syntax.

For example, the conditional statement "HCI_createTime greater_than ${NOW-1MONTH/DAY}" specifies a document that was created within the last month.

See the Solr date math documentation for proper syntax to use when writing an expression.

Supported date math operations are / (rounding), + (addition), and - (subtraction). Supported units of time are YEAR(S), MONTH(S), DAY(S), HOUR(S), MINUTE(S), and SECOND(S).

 

  • Was this article helpful?