Examples of building query requests

Each request to the Conversation Web Service consists of a filter state and a list of content element configurations and operators to compute. This topic provides examples showing the contents of a typical request.

Example with operator

The following request is used for a record search query. It specifies the search interface that must be used, and also the search terms entered by the user in the front-end application. It utilizes the Operator element. This element is the base type for various types of operators, such as AppplySpellingSuggestionOperator, RecordFilterOperator, RangeFilterOperator, and RefinementOperator.

In this specific example, state and content element configuration are not shown and only the operator is shown. The Operator is used with SearchOperator type, which adds a text search component to the filter state.

The SearchOperator specifies the options for the SearchFilter element, which are Key (representing the name of the search interface to use), and the text value of this element (representing the actual user-entered search terms):
<Operator xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
   xsi:type="SearchOperator" Within="false">
   <SearchFilter Mode="AllPartial" RelevanceRankingStrategy="numfields" 
      Key="Description">spice flavors</SearchFilter>
</Operator>

In general, for the SearchFilter type of Operator, you can specify various aspects of your request configuration, such as the name of the configured search interface, the search mode, the relevance ranking strategy, whether to enable snippeting, and the snippet length.

Similarly, for other types of Operator, you can specify options of their own. For instance, for the RangeFilterOperator, you can specify the range filter type and the lower and upper bound ranges.

To remove an operator from the filter state, you can use PopName_of_operatorOperator, where Name_of_operator is the name of the operator that you want to remove, such as RangeFilter, RecordFilter, or Search.

For more information on value search, search modes, and relevance ranking, see the dedicated sections in this guide. For more information on the detailed syntax of various types of operators, see the Oracle Endeca Server API Reference for the Conversation Web Service.

Example with state, operator and content element

The following example is used to request breadcrumbs in a search query that also returns spelling correction information. Such a request needs to include all three parts — state, operator, and content element configuration:
  1. The initial state that must be passed to the Oracle Endeca Server (it is empty in this example).
  2. The Operator of type SearchOperator, which uses SearchFilter to specify the actual user-entered search term that requires spelling correction and the search mode.
  3. The content element configuration, represented by ContentElementConfig. In this example, it contains a configuration requesting breadcrumbs (via BreadCrumbConfig) and a configuration requesting spelling correction (via SearchAdjustmentConfig).

    In general, the ContentElementConfig complex type can contain many subtypes, such as AttributeGroupListConfig, BreadCrumbConfig (as in the example below), LQLConfig, RecordListConfig, PropertyListConfig, or ValueSearchConfig. Each of these subtypes specifies a particular configuration, such as whether to return breadcrumbs, how to return lists of records or attributes, or which options to use when searching for attribute values.

To return to the example, it contains state, operator, and content element configuration, as follows:
<Request xmlns="http://www.endeca.com/MDEX/conversation/1/0">
 <State/>
   <Operator xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:type="SearchOperator" Within="false">
    <SearchFilter Mode="All" Key="English">
     fife
    </SearchFilter>
   </Operator>
 <ContentElementConfig 
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
 xsi:type="BreadcrumbConfig" ReturnFullPath="true" 
 HandlerFunction="BreadcrumbHandler" 
 HandlerNamespace="http://www.endeca.com/MDEX/conversation/1/0"
 Id="Breadcrumbs"/>
 <ContentElementConfig
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:type="SearchAdjustmentConfig"
 HandlerFunction="SearchAdjustmentHandler"
 HandlerNamespace="http://www.endeca.com/MDEX/conversation/1/0"
 Id="SearchAdjustments"/>
 <PassThrough>...</PassThrough>
</Request>

For more information on requesting breadcrumbs, see the section in this guide.