Obtaining the available search keys

The AvailableSearchKeys complex type lets you retrieve a list of the searchable attributes and search interfaces available in the data store.

The AvailableSearchKeys element contains one or more AvailableSearchKey elements. The complex type AvailableSearchKey identifies the items that are searchable — search interfaces and searchable properties. This type has the following format:
<complexType name="AvailableSearchKey">
  <annotation>
    <documentation>
   		A key used to identify searchable properties and search interfaces. 
    </documentation>
  </annotation>
  <sequence>
    <element name="Key" type="string"/>
    <element name="DisplayName" type="string" />
  </sequence>
  <attribute name="Interface" type="boolean" use="required" />
</complexType>

The Interface attribute distinguishes whether the search key is a searchable attribute or a search interface. If the search key is a search interface, the attribute is set to true. If the search key is not a search interface and is a searchable attribute, the attribute is set to false.

Request for available search keys

To make a request for available search keys, use the AvailableSearchKeysConfig component as illustrated in this example:
<Request xmlns="http://www.endeca.com/MDEX/conversation/1/0">
   <State/>
   <ContentElementConfig xsi:type="AvailableSearchKeysConfig" 
      HandlerFunction="AvailableSearchKeysHandler" 
      HandlerNamespace="http://www.endeca.com/MDEX/conversation/1/0" 
      Id="MySearchKeys" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" />
</Request>

The Id attribute is an identifier for the configuration.

Response for available search keys

The response contains an AvailableSearchKeys component that lists all of the searchable keys in a single alphabetically ordered list, as shown in this example:
<cs:Results xmlns:cs="http://www.endeca.com/MDEX/conversation/1/0" 
     xmlns:mdex="http://www.endeca.com/MDEX/XQuery/2009/09">
   <cs:Request>
      <State xmlns="http://www.endeca.com/MDEX/conversation/1/0" 
         xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"/>
      <ContentElementConfig xsi:type="AvailableSearchKeysConfig" 
        HandlerFunction="AvailableSearchKeysHandler" 
        HandlerNamespace="http://www.endeca.com/MDEX/conversation/1/0" 
        Id="MySearchKeys" xmlns="http://www.endeca.com/MDEX/conversation/1/0" 
         xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" 
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
   </cs:Request>
   <cs:ContentElement xsi:type="cs:AvailableSearchKeys" 
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <cs:AvailableSearchKey Interface="true">
         <cs:Key>AllWineSearch</cs:Key>
         <cs:DisplayName>AllWineSearch</cs:DisplayName>
      </cs:AvailableSearchKey>
      <cs:AvailableSearchKey Interface="false">
         <cs:Key>Description</cs:Key>
         <cs:DisplayName>Wine Description</cs:DisplayName>
      </cs:AvailableSearchKey>
      <cs:AvailableSearchKey Interface="false">
         <cs:Key>WineType</cs:Key>
         <cs:DisplayName>Wine Type</cs:DisplayName>
      </cs:AvailableSearchKey>
   </cs:ContentElement>
</cs:Results>

Each AvailableSearchKey element lists the name of a searchable attribute or search interface (the Key sub-element) and the display name (which can have a non-NCName format). If the search key is a search interface, the Interface attribute is set to true.

In this sample response, one search interface, AllWineSearch, and two attributes, Description and WineType, are listed as available search keys.