# Perform AgentBoolean Queries

After you create or index AgentBoolean categories and agents, you can start querying them.

To match documents that already exist in the IDOL Content component against the categories and agents, use the following actions:

- `AgentGetResults`. Returns results for a particular agent.

- `CategorySuggestFromDocument`. Returns categories that match a particular document in your IDOL Content component index.

To match IDX or XML documents that do not exist in the IDOL Content component, you can use the following actions with the `TextParse` parameter:

- `CategorySuggestOnText`. Returns categories that match the text you provide.

- `Query`. Returns documents that match the text you provide.

  NOTE: You must send the `Query` action to the IDOL Agentstore component to return agents or categories.

To perform a TextParse query

1. Percent-encode the content of the IDX or XML document that you want to match against the AgentBoolean agents or categories. For example:

       #DREREFERENCE http://www.catdog.com
       #DRETITLE Cats and Dogs
       #DREFIELD Animal10="dog"
       #DREFIELD Animal11="cat"
       #DRECONTENT
       The organisation takes care of homeless cats and dogs
       #DREENDDOC

   Percent-encoding turns this IDX into this string:

       %23DREREFERENCE%20http%3A%2F%2Fwww%2Ecatdog%2Ecom%0D%0A%23DRETITLE%20Cats%20and%20Dogs%0D%0A%23DREFIELD%20Animal10%3D%22dog%22%0D%0A%23DREFIELD%20Animal11%3D%22cat%22%0D%0A%23DRECONTENT%0D%0AThe%20organisation%20takes%20care%20of%20homeless%20cats%20and%20dogs%0D%0A%23DREENDDOC

2. Copy the percent-encoded content string.

3. Send a `Query` action to the IDOL Agentstore component with the following parameters:

   - `Text`. Paste the percent-encoded content of the IDX or XML document to match against the AgentBoolean categories.

   - `TextParse`. Set this parameter to `True` to indicate that the specified `Text` is a percent-encoded document in IDX or XML format (it automatically detects the correct format).

   - `AgentBooleanField`. Set this parameter to the name of the AgentBoolean field to match against.

   - `DatabaseMatch`. Set this parameter to the database that contains agents or categories in the IDOL Agentstore component. By default, Agentstore databases are internal, so you must specify them explicitly.

   For example:

       action=Query&TextParse=True&AgentBooleanField=myABfield&DatabaseMatch=Activated&Text=%23DREREFERENCE%20http%3A%2F%2Fwww%2Ecatdog%2Ecom%0D%0A%23DRETITLE%20Cats%20and%20Dogs%0D%0A%23DREFIELD%20Animal10%3D%22dog%22%0D%0A%23DREFIELD%20Animal11%3D%22cat%22%0D%0A%23DRECONTENT%0D%0AThe%20organisation%20takes%20care%20of%20homeless%20cats%20and%20dogs%0D%0A%23DREENDDOC

This query finds the categories that conceptually match the query text in the `Activated` Agentstore database. It then checks which of these categories contain a Boolean expression in their `myAbfield` that the fields in the percent-encoded document match.

NOTE: Agentstore also returns agents and categories that match the query text and do not contain the AgentBoolean or FieldText field.

Agentstore returns only categories that match the document conceptually and contain a Boolean expression that matches the document fields. For example:

- Agentstore returns a category that conceptually matches the document if its `myABfield` contains, for example, one of these Boolean expressions:

      cat AND dog

      cat:DRETITLE AND dog

- Agentstore does not return a category that conceptually matches the document if its `myABfield` contains, for example, one of these Boolean expressions:

      cat AND mat

      cat AND dog:Animal10

  (because `Animal10` is not configured as a `TextParseIndexType` field).

Related Topics

- Search and Retrieve

_FT_HTML5_bannerTitle.htm