Extending a catalog search

You can extend a catalog search to provide broader search capabilities by updating information in the catalog search index file. To update the index file, modify the corresponding extended XML configuration file.

About this task

The following components of catalog search are extensible:
  • Search system configurations
  • Locales and the corresponding analyzer
  • Query parser
  • Attributes

To extend a catalog search:

Procedure

  1. Copy the install_dir/repository/xapi/template/merged/resource/extn/ExtnCatalogSearchConfigProperties.xml.sample file to install_dir/extensions/global/template/resource/ExtnCatalogSearchConfigProperties.xml file OR modify your existing extension XML file.

    The following example shows a sample ExtnCatalogSearchConfigProperties.xml file.

    <SearchConfigurations>
      <SearchSystemConfigurations> 
        <MergeFactor Value="2"/> 
          <MaxMergeDocs Value="2147483647"/> 
       </SearchSystemConfigurations>
        <IndexSets> 
        <IndexSet Name="CatalogIndex"> 
          <Locales> 
           <Locale LocaleCode="en_US" 
            SynonymFile="/properties/EnglishSynonym.properties"/> 
            <Locale LocaleCode="fr_FR" 
              QueryParserClass="package.FrenchQueryParser.class"
              AnalyzerClass="package.FrenchAnalyzer.class" 
              SynonymFile="/properties/FrenchSynonym.properties"/> 
           </Locales> 
           <Entities> 
              <Entity Name="Item"> 
                 <Attributes> 
                   <Attribute XMLName="MyExtendedDescription" 
                     DefaultWeight="1.0" Index="ANALYZED"
                     Store="Y" UseSynonyms="N" Searchable="Y" Sortable="N"/> 
                   <Attribute IndexFieldName="CustomerItemDescription"
                     DefaultWeight="1.0" Index="ANALYZED" Store="Y" UseSynonyms="N"
                     Searchable="Y" Sortable="N" GetExternalValue="Y"/>
                </Attributes> 
                 <Entity Name="CategoryItem" RelationshipName="Category_ItemList"> 
                 <Entity Name="Category" RelationshipName="Category"> 
                <Attributes> 
                  <Attribute XMLName="MyCategoryExtendedDescription" 
                    DefaultWeight="1.0" Index="ANALYZED" Store="Y" 
                    UseSynonyms="N" Searchable="Y" Sortable="N"/> 
                </Attributes> 
               </Entity> 
               </Entity> 
               <Entity Name="Asset" RelationshipName="AssetList"> 
                <Attributes> 
                  <Attribute Type="MyManual" DefaultWeight="1.0" Index="ANALYZED" 
                   Store="N" UseSynonyms="N" Searchable="Y" Sortable="N"/> 
                 </Attributes> 
                </Entity> 
               </Entity> 
           </Entities> 
         </IndexSet> 
     </IndexSets> 
    </SearchConfigurations>
  2. To modify system configuration information for the index file, modify the elements in the SearchSystemConfigurations section of ExtnCatalogSearchConfigProperties.xml. The following table describes the SearchSystemConfiguration elements in ExtnCatalogSearchConfigProperties.xml.

    Element

    Description

    MergeFactor Value

    Specifies the number of documents that the Apache Lucene open source search engine stores in memory before writing them to disk as a single segment. For more information about setting this value, see the Lucene website.

    MaxMergeDocs Value

    Specifies the number of documents that can be contained in one segment. For more information about setting this value, see the Lucene website.

  3. To add or modify locale information for the index file, add or modify the elements in the Locales section of ExtnCatalogSearchConfigProperties.xml. The preceding example shows a sample ExtnCatalogSearchConfigProperties.xml file in which a synonym file has been added to the US-English locale, and a French locale has also been added. The following table describes the Locale elements in ExtnCatalogSearchConfigProperties.xml.

    Element

    Description

    LocaleCode

    Specifies the locale code for the index file. If you are adding a locale, ensure that you specify a corresponding analyzer. US-English is the default locale.

    QueryParserClass

    Specifies the path to the query parser. The application provides the Lucene query parser by default.

    AnalyzerClass

    Specifies the path to the analyzer. The application provides corresponding analyzers for the default locale.

    SynonymFile

    Specifies the path to the synonym file for the corresponding locale. Use the synonym file to configure related terms for keyword searches.

  4. To add item information for the index file, add the attributes in the Item section of ExtnCatalogSearchConfigProperties.xml. The preceding example shows a sample ExtnCatalogSearchConfigProperties.xml file in which the MyExtendedDescription attribute and the CustomerItemDescription attribute have been added. The following table describes Item attribute elements in ExtnCatalogSearchConfigProperties.xml.
    Note: You can add attributes to the extended XML configuration file for the catalog search index, but you cannot modify attributes nor add entities. See install_dir/repository/xapi/template/merged/resource/CatalogSearchConfigProperties.xml for a list of attributes that are supported by default.
  5. To add catalog information pertaining to the index file, add the attributes in the Category section of ExtnCatalogSearchConfigProperties.xml. The preceding example shows a sample ExtnCatalogSearchConfigProperties.xml file in which the MyCategoryExtendedDescription Category attribute has been added. The following table describes the Category attribute elements ExtnCatalogSearchConfigProperties.xml.
  6. To add asset information for the index file, add attributes in the Asset section of ExtnCatalogSearchConfigProperties.xml. The preceding example shows a sample ExtnCatalogSearchConfigProperties.xml file in which the asset with the asset type MyManual added. The following table describes attributes for CatalogSearchConfigProperties.xml.
    Note: The application calls the YCMParseAssetUE user exit to parse the content of the asset for the corresponding asset type.

    Attribute

    Description

    XMLName

    For item and category attributes of Item Entity, specifies the XML attribute name for the field.

    IndexFieldName

    Specifies the field name of the attribute as stored in the index. Values for IndexFieldName must be unique throughout the configuration file. If IndexFieldName is not configured in the xml configuration file, the system derives a value for it based on the formula Entity Name.XMLName.

    Type

    For asset attributes, specifies the asset type in the database.

    Default Weight

    Specifies the weight given to the term. The default value is 1.

    Index

    Specifies one of the following options for storing field values:

    Analyzed - stores the value as searchable segments. For example, if a user searches for Desktop Computers and the index parameter for the field is analyzed, the search results include items with the terms Desktop Computer, Desktop, and Computer.

    Non_analyzed - stores the value as it appears in the database, requiring an exact match to return the value. In the previous example, if the search for Desktop Computers was performed on a non_analyzed field, the search would return only items with the term Desktop Computer.

    Store

    Specifies one of the following options for storing field values:

    Y - stores the value of the attribute in the index so that it may be returned as search output. If the GetExternalValue attribute is set to Y, Store is treated as Y.

    N - does not store the value and only keeps data in the index for the attribute that is in a proprietary format and used only during the search.

    UseSynonyms

    Specifies one of the following options for including synonyms in the search:

    Y - indicates that search queries include synonyms.

    N - indicates that search queries do not include synonyms.

    Searchable

    Specifies one of the following search options for the field:

    Y - indicates that the field is included as possible search criteria when creating a search query.

    N - indicates that the field is not included as possible search criteria when creating a search query.

    For example, the Searchable parameter for the Is_Superseded field in the default XML file is set to N and the Store parameter is set to Y. Users cannot search on the Is_Superseded field in a query. However, queries of superseded items that are obsolete return the superseding items.

    Sortable

    Specifies one of the following sort options for the field:

    Y - indicates that search results are sorted by this field.

    N - indicates that search results are not sorted by this item.

    GetExternalValue

    Specifies one of the following options for the field:

    Y - indicates that the value for this attribute is obtained from an external source through a user exit.

    N - indicates that the user exit is not called.