Configuring HiliteFields


Matching fragments in returned InSite Search results return all valid fields by default. When you enable HiliteFields, search results display according to the Field order in the HiliteFields configuration file. These search results will display until the maximum character limit is reached. If any field in the provided configuration does not contain the matching term, then the field will not be included in the Matching Fragment results.

To configure HiliteFields.xml:
  1. Open your DSS project in Visual Studio, and update to the latest version of InSite Search 2 via NuGet Package Manager.
  2. Rebuild your Visual Studio project.
  3. Download the following sample configuration file: HiliteFields.xml.The example below displays generic code contained within HiliteFields.xml.
    <HiliteFields enabled="true">
       <Field>Title</Field>
       <Field>Abstract</Field>
       <Field>BodyCopy</Field>
       <Field>name</Field>
       <Field>fulltext</Field>
       <Field>path</Field>
       <Field wildcard="true">Bod</Field>
       <Field partialfieldnamematch="true">Heading</Field>
    </HiliteFields>
  4. Open HiLiteFields.xml in a text editor, and change the root element's @enabled attribute to true.
  5. Modify the configuration file to include additional <Field> elements.
    • <Field> name values are the indexed fields that contain values used in matching fragments for terms. The fields generally match the element names that you expect to be returned (e.g., "Abstract").
    • <Field> name values must be inserted between the start and end <Field> tags.
    • When the value of the @wildcard attribute (Boolean) on the <Field> element is set to true, then all instances of the element name are included in the highlighted search results.

    For example, for Title__One and Title__Two, then:

    <Field wildcard="true">Title</Field>            
    Note
    If the file does not contain any <Field> elements, then the Matching Fragments fall back to a default state (i.e., returns all valid fields).
  6. Save your configuration file to your DSS server.
    Important
    If you save HiliteFields.xml to the Config folder (e.g., [Drive]:\[path to DSS root directory]\Config\HiliteFields.xml), then you can skip the next step. You do not need to configure Search.config — because the Config folder is the default location of HiliteFields.xml.
  7. Navigate to [Drive]:\[path-to-DSS-root-directory], and open Search.config in a text editor. The example below displays generic code contained within Search.config.
    <?xml version="1.0"?>
    <configuration>
        <configSections>
            <section name="Search"
                type="Ingeniux.Search.Configuration.IndexingConfiguration, Ingeniux.Search"/>
        </configSections>
        <Search indexLocation="App_Data\LuceneIndex"
            synonymsLocation="[Drive]:\[path to DSS root directory]\published\iss-config\Synonyms.xml"
            indexingEnabled="true" queryMaxClauses="1024">
            <Hiliter startTag="&lt;strong&gt;" endTag="&lt;/strong&gt;"/>
            <Settings>
                <add name="defaultIndexingAnalyzer"
                    value="Ingeniux.Search.Analyzers.StemmingIndexingAnalyzer, Ingeniux.Search"/>
                <add name="defaultQueryAnalyzer"
                    value="Ingeniux.Search.Analyzers.StemmingQueryAnalyzer, Ingeniux.Search"/>
                <add name="QueryFieldsFileLocation"
                    value="[Drive]:\[path to DSS root directory]\[subfolder(s)]\QueryFields.xml"/>
                <add name="DocumentBoostByFacetsFileLocation"
                    value="App_Data\DocumentBoostByFacetsFileLocation.xml"/>
                <add name="GSearchFieldMapping"
                    value="[Drive]:\[path to DSS root directory]\[subfolder(s)]\GSearchFieldMapping.xml"/>
            </Settings>
            <IndexingSources>
                <add name="CMSPublishedContent" type="Ingeniux.Runtime.Search.DssContentSearchSource"
                    settingsFile="[Drive]:\[path to DSS root directory]\settings\SearchSource.config"/>
                <add name="KeyMatch" type="Ingeniux.Search.KeyMatchSearchDocumentSource"
                    settingsFile="App_Data\KeymatchSource.config"/>
                <add name="SpellCheckDictionary" type="Ingeniux.Search.SpellCheckerSearchDocumentSource"
                    settingsFile="App_Data\spellcheckerSource.config"/>
                <add name="SiteCrawlerSource" type="Ingeniux.Search.HtmlSiteSource"
                    settingsFile="App_Data\sitecrawlerSource.config"/>
                <add name="Analytics" type="Ingeniux.Search.AnalyticsSearchDocumentSource"
                    settingsFile="App_Data\analyticSource.config"/>        
            </IndexingSources>
            <SearchProfiles>
                <add name="Independent-search-profile-1">
                    <Sources>
                        <add name="KeyMatch"/>
                        <add name="SpellCheckDictionary"/>
                        <add name="analytics"/>
                    </Sources>
                </add>
            </SearchProfiles>
        </Search>
    </configuration>
  8. In Search.config, include an <add> tag within <Settings>, then set the following attributes:
    • @Name: HiliteFieldsFileLocation
    • @Value: Enter an absolute path to the configuration file as it resides on the DSS server after replication (e.g., [Drive]:\[path to DSS root directory]\[subfolder(s)]\HiLiteFields.xml).
  9. Save and close Search.config.
  10. After the initial configuration of HiliteFieldsFileLocation, recycle the DSS application pool so that the system picks up the new file's location.
    Note
    All subsequent changes to HiLiteFields.xml are reflected in search results.