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.
Note: 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. It is not recommended that you increase 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 VS project.
- Download the following sample configuration file: 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>
Version Notes: ISS 2.13+ InSite Search 2.13 introduces the wildcard and partialfieldnamematch attributes to fine-tune which fields you want to execute your queries against. Refer to their setting details below.
- Open QueryFields.xml in an 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.
- 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.
- 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.
Note: The partialfieldnamematch setting takes priority if both partialfieldnamematch and wildcard are set to true.
- Save your configuration file to your DSS server.
Note: If 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.
- In Search.config, include an add tag 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).
- Save Search.config.
- 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.