IDOL Category Component 24.2

# Use Metafields

The IDOL Content component does not permanently store the values for user metafields, but you can use the results in the `Query` or `GetQueryTagValues` action.

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

## FieldText

You can use metafields in `FieldText` operators. For example:

    action=Query&Text=Television&UserMetaFields=ADD{TOTAL}:PRICE:TAX&FieldText=EQUAL{500}:autn_user_TOTAL

In this example, the `UserMetaFields` operation adds the value of the `PRICE` and `TAX` fields in documents that match the query for `Television`. It creates the `TOTAL` field for each document to store this result, and returns only documents where the new `TOTAL` field has a value of `500`.

Related Topics

- FieldText Search

## Sort

You can use metafields in the `Sort` parameter to sort your result documents. For example:

    action=Query&Text=Television&UserMetaFields=MIN{LOWSCORE}:REVIEWSCORE&Sort=autn_user_LOWSCORE:decreasing

In this example, the `UserMetaFields` operation takes the lowest value of the `REVIEWSCORE` fields in a document that matches the query for `Television`. It creates a `LOWSCORE` field for each document to store this result, and returns documents in decreasing order of the `LOWSCORE` field.

Related Topics

- Change Result Sorting (Display Order)

## PrintFields

You can specify metafields in the `PrintFields` parameter to display the metafields in the results.

NOTE: By default, when you set `Print` to `all`, metafields do not return in results. In this case, you can set the `PrintFields` parameter to a list of metafields to display them.

    action=Query&Text=Television&UserMetaFields=MIN{LOWSCORE}:REVIEWSCORE&Print=Fields&PrintFields=autn_user_LOWSCORE

In this example, the `UserMetaFields` operation takes the lowest value of the `REVIEWSCORE` fields in a document that matches the query for `Television`. It creates a `LOWSCORE` field for each document to store this result, and displays the `LOWSCORE` field in the results.

## GetQueryTagValues FieldName

In the `GetQueryTagValues` action, you can use metafields as the `FieldName` that you want to return results for. For example:

    action=GetQueryTagValues&Text=Television&UserMetaFields=MEAN{AVERAGE}:PRICE&FieldName=autn_user_AVERAGE

In this example, the `UserMetaFields` operation calculates the mean value of the `PRICE` fields in documents that match the query for `Television`. It creates an `AVERAGE` field for each document to store this result, and then returns the values that occur in the `AVERAGE` field as tags for the parametric search.

    action=GetQueryTagValues&Text=Restaurants&UserMetaFields=DISTSPHERICAL{HOME,51.3,0.73}:LAT:LONG&FieldName=autn_user_HOME&Ranges=FIXED{0,5,10,20,.}:autn_user_HOME&DocumentCount=true

In this example, the `UserMetaFields` operation finds documents that match the query for `Restaurants`, and uses the document `LAT` and `LONG` fields to calculate the distance from a location in London. It creates a `HOME` field for each document to store this distance, and then returns the number of documents that occur within the specified distances from the original point, grouped by the specified ranges (0-5, 5-10, 10-20, 20+).

Related Topics

- Parametric Search

## AgentBoolean

You can use metafields as part of an agent, and use the metafield in AgentBoolean queries.

For example, you might create the following agent IDX file, and index it into the Agentstore component:

    #DREREFERENCE UserMetaFields
    #DREFIELD AGENTBOOL="usermeta"
    #DREFIELD FTF="GREATER{5}:autn_user_X"
    #DREFIELD AGENTPARAMS="UserMetaFields=MEAN{X}:NUMBER"
    #DRECONTENT
    usermeta
    #DREENDDOC

This IDX file includes the `UserMetaFields` parameter in the `AGENTPARAMS` field, and a `FieldText` expression that uses the resulting metafield in the `FTF` field.

For this example, when you send a `Query` action to the Agentstore to return agents that match a document, you also set the following parameters in the action:

-     TextParse=True

-     AgentBooleanField=AGENTBOOL

-     FieldTextField=FTF

-     AgentParamsField=AGENTPARAMS

For a document to match this example agent, it must include the term `usermeta`. When the document matches the `usermeta` term, the agent calculates the mean of the values in the `NUMBER` fields, and creates an `X` field to contain the mean. For the agent to return as a match for the document, the document `X` metafield must have a value greater than 5.

Related Topics

- AgentBoolean Agents and Categories

- Perform AgentBoolean Queries

Copyright 2024 Open Text
Version 24.2 | Last updated March 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.2

Topic Title: Use Metafields