Configuring DocumentBoostsByFacets


Depending on the indexed data set for InSite Search, the default behavior may result in large, complex queries. The DocumentBoostsByFacets feature improves performance and focuses search result sets by providing administrators with the means to target query fields. Administrators can specify certain fields from documents indexed by the CMS with the DocumentBoostsByFacets configuration file. When you boost a field, the content containing the boosted field will rank higher than other matching content in the score calculation formula, provided all other factors are equal.

Because this feature affects index-time boost score calculation, you need to delete and then re-index your publish content when either the feature is first enabled or each time an adjustment is made to the configuration file for this feature. For this reason, we recommend that you test your adjusted values in a test environment prior to implementing changes in production environments.

To configure DocumentBoostsByFacets.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 VS project.
  3. Download the following sample configuration file: DocumentBoostByFacets.xml.The example below displays generic code contained within DocumentBoostByFacets.xml.
    <FacetBoosts enabled="true">
        <!-- Sample Facet value below: the fieldName "_CATS_ID", which is Taxonomy, is delimited 
             with spaces in the Lucene index.Each Boost term corresponds with a Taxonomy ID for
    	  each page. Boost Values should be values between 0 and 4 -->
        <Facet fieldName="_CATS_ID" delimited="true" delimitor="space">
    	<Boost value="184" boostValue="3"/>
    	<Boost value="481" boostValue="2.6"/>
        </Facet>
    </FacetBoosts>                     
  4. Open DocumentBoostByFacets.xml in a text editor and verify that the root element's @enabled attribute is set to true.
  5. Modify the configuration file to include additional elements.
    1. Each element needs to include the following attributes:
      • @fieldName: The name of the field within which the targeted terms are located. Usually, this is the CMS element name value (e.g., BodyCopy, SEO_Words, _CATS_ID).
      • @delimited: True indicates that the field is a list of delimited values whereas, false indicates it is a single value.
      • @delimitor: This option only supports lists that are delimited with spaces or commas. In the case of space-delimited values, the configuration value must be space.
    2. For each element, add an element to define the term for boosting against, as well as the @boostValue to add.
      Important
      Keep the @boostValue value within the range of 1-4.
  6. Save your configuration file to your DSS server.
    Important
    If you save DocumentBoostByFacets.xml to the Config folder (e.g., [Drive]:\[path-to- DSS-root-directory]\Config\DocumentBoostByFacets.xml), then you can skip the next step — you do not need to configure Search.config — because the Config folder is the file's default location.
  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> element within the <Settings> and set the following attributes:
    • @Name: DocumentBoostByFacetsFileLocation
    • @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)]\DocumentBoostByFacets.xml).
    For example, your <add> element and attributes should look similar to the following code:
    <add name="DocumentBoostByFacetsFileLocation" value="App_Data\DocumentBoostByFacetsFileLocation.xml"></add>
  9. Save and close Search.config.
  10. After the initial configuration of DocumentBoostByFacetsFileLocation.xml, recycle the DSS application pool so that the system can pick up the new file's location. All subsequent changes to DocumentBoostByFacets.xml are reflected in search results.