IDOL Category Component 24.4
IDOL Category Component Help

# Create Metafields

The `UserMetaFields` parameter has the following syntax:

    UserMetaFields=OPERATION{UserFieldName}:DocumentFieldName

where:

`OPERATION` | is the operation that you want to perform on the contents of the specified fields in your documents.
`UserFieldName` | is the name of the user metafield that you want to create.
`DocumentFieldName` | is the name of the fields in your documents that you want to run the specified operation on. To specify multiple fields, separate the field names with colons (:) (there must be no space before or after a colon).

NOTE: `UserMetaFields` operations are more efficient when you use them on fields that are configured as `NumericType`, except for the `COUNTA` operation, which is more efficient on fields that are configured as `CountType`, `MatchType`, or `ParametricType`.

To specify multiple operations, separate the operations with a plus sign (+) or a space.

You can optionally use a constant in the `UserMetaFields` definition, in the following form:

    UserMetaFields=OPERATION{UserFieldName, Constant}:DocumentFieldName

The constants can be positive or negative, and they can include decimals (for example 1.23) and scientific notation (for example 1E2). The meaning of the constants depends on the operation that you use.

NOTE: The IDOL Content component uses the constant only if the `DocumentFieldName` contains values. For example, for the operation `MIN{MINSCORE,10}:SCORE`, Content does not create a `MINSCORE` user metafield if the `SCORE` field is missing for a document.

The following table describes the operations that you can perform on document fields.

Operation | Description | Constant
--- | --- | ---
`ADD` | The sum of all the values in the specified fields. | The initial value to add the field values to.
`SUB` | The value of the first field name (or the sum of the values in all instances of the first field name), minus the values of the remaining fields. | An additional value to subtract.
`MUL` | The product of all the values in the specified fields. | The initial value to multiply the field values by.
`DIV` | The value of the first field name (or the product of the nonzero values in all instances of the first field name), divided by the nonzero values from the remaining fields. | An additional value to divide by. If the constant value is 0, the constant is ignored.
`MIN` | The smallest value in the specified fields. | An initial value to include in the minimum calculation.
`MAX` | The highest value in the specified fields. | An initial value to include in the maximum calculation.
`MEAN` | The mean of the values in the specified fields. | No effect.
`COUNT` | The number of numeric values in the specified fields (it does not count any non-numeric values). | No effect.
`COUNTA` | The number of non-empty occurrences of the specified field, regardless of their value. | No effect.
`ABS` | The absolute value of the value in the specified field (that is, removing any negative sign). | No effect.
`ROUND` | The nearest integer to the value in the specified field, or the nearest multiple of the specified constant. | The accuracy to round to. For example, 0.01 rounds to two decimal places.
`FLOOR` | The nearest integer that is lower than the value in the specified field, or the nearest multiple of the specified constant lower than the value. | The accuracy to round down to. For example, 0.01 rounds to two decimal places.
`LOG` | The log (to the base of the specified constant) of the value of the first instance in a document of the specified field. The constant is required for this function. | The base of the log.
`POW` | The value of the first instance in a document of the specified field, raised to the power of the specified constant. The constant is required for this function. | The power to use.

NOTE: The `ABS`, `ROUND`, `FLOOR`, `LOG`, and `POW` operations act on a single value for each document. OpenText recommends that you use these operations on fields that have only a single value, or on the output of other user metafield operations. If you apply these operations to a field with multiple values, it returns the result of the operation on the first field value, which might depend on your configuration.

You can also use the following distance operations. In this case, you must specify two constants and two field names that contain the location information.

Operation | Description | Constant
--- | --- | ---
`DISTSPHERICAL` | The distance in kilometers between the location specified by the constants, and the location specified by the document fields, in latitude and longitude. You can specify the location fields as two fields in the form `:LAT_FIELD:LONG_FIELD`, or a single field that contains Well-known text format POINT definitions. | The latitude and longitude of the location you want to calculate distances from. Specify these values as `lat,long`.
`DISTCARTESIAN` | The distance between the point specified by the constants, and the point specified by the document fields, in cartesian coordinates. You can specify the location fields as two fields in the form `:X_FIELD:Y_FIELD`, or a single field that contains Well-known text format POINT definitions. | The X and Y coordinate of the point that you want to calculate distances from. Specify these values as `X,Y`.

NOTE: The `DISTSPHERICAL` and `DISTCARTESIAN` operations act on a single pair of values for each document (one value for each coordinate field). OpenText recommends that you use these operations on fields that have only a single value, or the output of other user metafield operations. If you apply these operations to a field with multiple values, it returns the result of the operation on the first field value, which might depend on your configuration.

If both of your coordinate fields are configured as `NumericType`, OpenText recommends that you set `XMLFullStructure` to `True` in your configuration. With this additional configuration, distance-based metafields produce results consistent with distance-based sorting.

You can apply `UserMetaFields` operations to other user metafields created in the same query. For example, you might use an operation to create one field, and then use that field in a second operation. You must create a metafield before you reference it in another operation (that is, the operation to create the field must appear to the left of the operation that uses it in the `UserMetaFields` parameter).

When you use your metafield in another operation, the field name has the format `autn_user_UserFieldName`, where `UserFieldName` is the value that you specified in the `UserMetaFields` parameter.

For example, the following query creates the `TaxAmount` user metafield from the document fields, and then uses this new metafield to calculate the total price.

    UserMetaFields=MUL{taxAmount}:basePrice:taxRate,ADD{totalPrice}:basePrice:autn_user_taxAmount

Copyright 2024 Open Text
Version 24.4 | Last updated September 2024

Send documentation feedback

Close

Send documentation feedback

To send feedback using your default email client, open an email window.

Otherwise, send your feedback and the information below to MFI-swpdl.idoldocsfeedback@opentext.com.

We appreciate your feedback!

Product: IDOL IDOL Category Component 24.4

Topic Title: Create Metafields