Configuring QueryFields
Administrators can adjust search results by configuring a list of targeted fields to query against. This feature improves performance and focuses search result sets by providing administrators with the means to target query fields. By default, InSite Search indexes all fields. This configuration does not limit the search index size; rather, it limits the fields queried. Implementing QueryFields improves search result performance but may cause pages to be omitted, which would otherwise show up in the search results.
Troubleshooting
If you turn off QueryFields, you may encounter a situation in which
the Lucene query is too long. To resolve this, increase the QueryMaxClauses value
(the default value is 1024 bytes.). Values above 2048 bytes tend to impact performance.
We do not recommend increasing the QueryMaxClauses value above 4096 bytes.
To configure QueryFields.xml:
- Open your DSS project in Visual Studio and update to the latest version of InSite Search 2 via NuGet Package Manager.
- Rebuild your Visual Studio project.
- Download the following sample configuration file: QueryFields.xml.
The example below displays generic code contained within QueryFields.xml. <QueryFields enabled="true"> <!-- If true, wildcard matches any part of the provided field. --> <Field wildcard="true">Title</Field> <!-- If true, matches part of field exactly. (e.g., ThisGroup__ThisList__BodyCopy__1) --> <Field partialfieldnamematch="true">BodyCopy</Field> <!-- Values define targeted fields to index and query against. --> <Field>Abstract</Field> <Field>name</Field> <Field>fulltext</Field> <Field>path</Field> </QueryFields>
- Open QueryFields.xml in a text editor, and ensure the root
element's
@enabled
attribute is set to true. - Modify the configuration file to include additional
<field>
elements:- Typically,
<Field>
names are the element names that are expected to be returned. - Each
<Field>
name needs to be positioned between the<Field>
tags. - If the file does not contain any
<Field>
elements, then the matching fragments will fall back to the default state, which is to query all fields. - Version Notes: ISS 2.13+
@wildcard
attribute: This is a wildcard lookup for terms that match any part of the field value provided. To enable this setting, set the@wildcard
value to true.Note@wildcard
is not as optimized as@partialfieldnamematch
, as it is a full wildcard lookup. - Version Notes: ISS 2.13+
@partialfieldnamematch
attribute: This matches a part of the field value exactly (e.g., If the Field value is Heading, then the query executes on fields that are named ThisGroup__ThisList__BodyCopy__1.) To enable this setting, set the@partialfieldnamematch
value to true.NoteThe@partialfieldnamematch
setting takes priority if both@partialfieldnamematch
and wildcard are set to true.
- Typically,
- Save your configuration file to your DSS server.NoteIf you save QueryFields.xml to the Config folder (e.g., [Drive]:\[path to DSS root directory]\Config\QueryFields.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 QueryFields.xml.
- 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="<strong>" endTag="</strong>"/> <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>
- In Search.config, include an
<add>
element within<Settings>
, then set the following attributes:@Name
: QueryFieldsFileLocation@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)]\QueryFields.xml ).
For example, your <add>
element and attributes should look similar to the following code: - Save and close Search.config.
- In Search.config, include an
<add>
tag within the<Settings>
tag, and set the following attributes: - After the initial configuration of QueryFieldsFileLocation, recycle the DSS application pool so that the system can pick up the new file's location. All subsequent changes to QueryFields.xml will be reflected in search results.