Implementing Boolean search with the API

Using requests to the Conversation Web Service, you can specify a Boolean search mode for any search request that performs value or attribute search, or a search request against defined search interfaces. You can also use Boolean search in record and attribute filters. This topic includes examples of these requests.

Before using search on any attributes, ensure that attributes are configured for either record search and/or managed attribute value search. For information, see Enabling value search.

Boolean search in value search

In this example, Boolean search mode is used for a value search made with the ValueSearchConfig type:
<ValueSearchConfig Id="ValSearch" MaxPerProperty="5" Mode="Boolean" Language="en">
   <StateName>MySearch</StateName>
   <SearchTerm>"Bike Racks" AND "Handlebars"</SearchTerm>
</ValueSearchConfig>

Boolean search in attribute filters

When you set up the attributes for which to search using the TextSearchFilter type, you also set a match mode that should be used for search. To use boolean search for the search mode, you set the match mode to Boolean. The following example illustrates the TextSearchFilter that uses Boolean search:
<State>
   <Name>MyRecSearch</Name>
   <TextSearchFilter Key="Description" Mode="Boolean" EnableSnippeting="false" 
     Language="en">"peach" AND "apple"</TextSearchFilter>
</State>

Boolean search in search interfaces

Before you use Boolean search against search interfaces, you need to configure one or more search interfaces that include all of the attributes that you want to search. This is done through the putConfigDocuments operation of the Configuration Web Service, by sending in an XML configuration document RECSEARCH_CONFIG. For information on how to send XML configuration documents to the Oracle Endeca Server, see Loading configuration documents.

Now you can create a single Boolean search request against the defined search interfaces:
<State>
   <Name>MyRecSearch</Name>
   <TextSearchFilter Key="AllSales" Mode="Boolean" EnableSnippeting="false" 
     Language="en">English : one AND Spanish : dos</TextSearchFilter>
</State>