The Discover Electronics application includes reference implementations of several commonly-used search features. The configuration models for these features are described in the following section.

The Search Box cartridge enables the site visitor to enter search terms and view record results. If dimension search is enabled, dimension search results may also be displayed. A content administrator can configure Search Box behavior such as whether to apply search adjustments or display auto-suggest search results.

The response model for this cartridge is SearchBox.

The Search Box cartridge does not make use of a configuration model or a cartridge handler; properties specified in the cartridge template and in the end user's search request are passed through to the renderer.

Because the Search Box enables keyword search for records and dimension values, most search configuration affects the behavior of this cartridge. This section focuses on record search configuration.

Auto-suggest search results display as the site visitor types in the search box, rather than displaying after the visitor has completed the search. In the Discover Electronics reference application, the Search Box cartridge calls the typeahead service to display auto-suggest search results. The typeahead service must be configured by a content administrator.

A cartridge configuration class "ApplicationFilterStateConfig" represents a dynamic application filter state. This dynamic application filter state should be specified in the service or page definition as a property named "@appFilterState".


Sample content.xml

<ContentItem type="Page" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xmlns="http://endeca.com/schema/content/2008"
             xmlns:xavia="http://endeca.com/schema/xavia/2010">
    <TemplateId>TypeaheadService</TemplateId>
    <Name>Typeahead Service</Name>
    <Property name="@appFilterState">
        <ContentItem type="ApplicationFilterStateConfig">
            <Property name="typeAhead">
                <Boolean>true</Boolean>
            </Property>
            <Property name="recordFilters">
                <xavia:List>
                    <String>product.active:1</String>
                </xavia:List>
            </Property>
        </ContentItem>
    </Property>
    <Property name="resultsList">
        <ContentItem type="ResultsList">
            <TemplateId>ResultsList</TemplateId>
            <Property name="recordsPerPage">
                <String>3</String>
            </Property>
        </ContentItem>
    </Property>
</ContentItem>

The Dimension Search Results cartridge displays refinement links based on the names of dimension values that match the search keywords entered by the site visitor.

The dimension search results display in a panel after the site visitor performs the search. These results provide suggestions for additional navigation refinements based on the search terms.

The response model for this cartridge is DimensionSearchResults. It contains a list of DimensionSearchGroup objects that in turn contain dimensionSearchValues that provide refinement links.

Search adjustments include automatic spelling correction, automatic phrasing, and Did You Mean functionality.

The response model for this cartridge is SearchAdjustments.

The behavior of the spelling correction and Did You Mean features are configured at the MDEX Engine level. The Search Adjustments cartridge enables content administrators to specify whether or not search adjustments messaging displays on a page; it does not have any configuration options in Experience Manager.

Search adjustments features are configured at indexing and at Dgraph startup.

You can configure the MDEX Engine to consider certain combinations of words in a text search as a phrase search and specify whether to apply phrasing automatically to a site visitor's text search queries.

The high level steps for enabling automatic phrasing are:

You enable the MDEX Engine to compute phrases that can be applied to a site visitor's text search by creating a phrase dictionary. For information about creating a phrase dictionary, refer to the section on Automatic Phrasing in the MDEX Engine Developer's Guide.

You can configure the default behavior of the Assembler application as to whether to automatically rewrite a text search as a phrase search or keep it as a search for individual keywords using the following property on the Filter State object:

The autoPhraseEnabled setting on the default Filter State can be overridden at query time using the URL parameter autophrase. If the value of autophrase is 1, then computed phrases are automatically applied to the query. If the value is 0 then phrases may still be computed, but are not automatically applied to the query.

The Filter State configuration in the Assembler context file for the Discover Electronics reference application is shown below:

<bean id="navigationStateBuilder" scope="request"
    class="com.endeca.infront.navigation.url.UrlNavigationStateBuilder">
    <!-- additional elements removed from this example -->
                        <property name="defaultFilterState">
        <bean scope="singleton" class="com.endeca.infront.navigation.model.FilterState">
            <property name="rollupKey" value="product.code" />
            <property name="autoPhraseEnabled" value="true" />
            <!-- <property name="securityFilter" value="" /> -->
            <!-- <property name="languageId" value="en" /> -->
        </bean>
    </property>
    <!-- additional elements removed from this example -->
</bean>

For Oracle Commerce Experience Manager, if your application contains multiple sites, Oracle recommends using a filterState.xml file instead of the Filter State configuration in the Assembler context file. For example, a filterState.xml file in /pages/DiscoverElectronics/ might contain the following autophrase property:

<Item class="com.endeca.infront.navigation.model.FilterState" xmlns="http://endeca.com/schema/xavia/2010">
 <Property name="autoPhraseEnabled">
     <Boolean>true</Boolean >
 </Property>
</Item>

In the Discover Electronics application, the default behavior is to automatically apply phrases to text search queries and to return the unphrased version as a search suggestion.

In this scenario, autoPhraseEnabled is set to true on the default Filter State object, and the Search Box cartridge sets Nty=1 on the text search query. The user has two choices:

These outcomes are summarized in the following table:

Content administrators can configure keyword redirects that redirect a front-end user to a new page if the user's search terms match the set keyword.

When an end user enters a search term that matches a keyword redirect, the Assembler returns the redirect URI with the response model. The Assembler response can be limited to the redirect URI, or it can also return the results for the user's search term.

The content administrator specifies a search term, match mode, and redirect URI on the Keyword Redirects page in Workbench.

The Assembler API includes a RedirectAwareContentIncludeHandler that implements keyword redirect functionality.

The cartridge handler takes the following two properties:

The cartridge handler configuration in the Assembler context file for Discover Electronics is shown below:

<!--
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ~ BEAN: CartridgeHandler_ContentInclude
    ~ Used by the assembler service when keyword redirects are not enabled
-->
<bean id="CartridgeHandler_ContentInclude" 
  class="com.endeca.infront.content.ContentIncludeHandler"
  scope="prototype">
    <property name="contentSource" ref="contentSource" />
    <property name="siteState" ref="siteState"/>
				<property name="userState" ref="${user.state.ref}"/>
</bean>

<!--
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ~ BEAN: CartridgeHandler_RedirectAwareContentInclude
    ~ For root calls to the assembler when keyword redirects are desired
-->
<bean id="CartridgeHandler_RedirectAwareContentInclude" 
  class="com.endeca.infront.cartridge.RedirectAwareContentIncludeHandler"
  scope="prototype">
    <property name="contentSource" ref="contentSource" />
    <property name="contentBroker" ref="contentRequestBroker" />
    <property name="navigationState" ref="navigationState" />
    <property name="defaultFullAssembleOnRedirect" value="false"/>
    <property name="siteState" ref="siteState"/>
				<property name="userState" ref="${user.state.ref}"/>
</bean>

In order to execute a redirect, an application must include logic for handling the URI components returned from the Assembler. You must use the RedirectAwareContentInclude class for any content items that require keyword redirect functionality.

The assemble.jsp service uses the RedirectAwareContentInclude class to enable keyword redirects, as shown below:

                        <%@page import="com.endeca.infront.cartridge.RedirectAwareContentInclude"%>

...

AssemblerFactory assemblerFactory = (AssemblerFactory)webappCtx.getBean("assemblerFactory");
Assembler assembler = assemblerFactory.createAssembler();

//Retrieve the content for the given content uri
ContentItem contentItem = new RedirectAwareContentInclude("/browse" + contentUri);

// Assemble the content
ContentItem responseContentItem = assembler.assemble(contentItem);


Copyright © Legal Notices