Configuring database search criteria in XML

You use the search-config.xml file to define a mapping between the key data entities and certain non-persistent entities used for search criteria. The entries in the file have the following basic structure:

<CriteriaDef entity="name" targetEntity="name">

  <Criterion property="attributename" targetProperty="attributename" matchType="type"/>

</CriteriaDef>

You can map a single search criteria entity to more than one target entity.

Do not add new <CriteriaDef> elements into search-config.xml. Only modify the contents of existing criteria definitions. Do not remove a required base CriteriaDef element. Adding or removing these elements can introduce problems into your PolicyCenter installation.

Warning: Guidewire strongly recommends you do not remove <CriteriaDef> elements that exist in the base configuration.

Search criteria XML elements

The following table describes the XML elements in the search-config.xml file.

Element name

Subelement

Description

More information

SearchConfig

CriteriaDef

Root element in search-config.xml.

CriteriaDef

Criterion

Specifies the mapping from a search criteria entity to the target entity on which to search.

WARNING Do not add or remove CriteriaDef elements in search-config.xml. Modify only the contents of existing CriteriaDef elements.

The <CriteriaDef> element

Criterion

Specifies how PolicyCenter matches a column (field) on the search criteria to the query against the target entity. Use this element to perform simple matching only. Simple matches are criteria that match values in a single column of the same type in the target entity.

The <Criterion> subelement

The <CriteriaDef> element

A <CriteriaDef> element specifies the mapping from a search criteria entity to the target entity on which to search. For example, a <CriteriaDef> element can specify a mapping between a DocumentSearchCriteria entity and a Document entity. A <CriteriaDef> element uses the following syntax.

<CriteriaDef entity="entityName" targetEntity="targetEntityName">

These attributes have the following definitions.

<CriteriaDef>  attribute

Required

Description

entity

Type name of the criteria entity

targetEntity

Type name of the target entity.

A <CriteriaDef> element can have the following subelement.

<CriteriaDef>  subelement

Description

More information

Criterion

Performs simple, one-to-one mapping between a criteria entity attribute and a target entity attribute.

The <Criterion> subelement

The <Criterion> subelement

Within a <CriteriaDef> element you can define zero or more <Criterion> subelements. A <Criterion> element performs simple, one-to-one mapping between a criteria entity attribute and a target entity attribute. A <Criterion> element uses the following syntax.

<Criterion property="attributename" 
           targetProperty="attributename"
           forceEqMatchType="booleanproperty" 
           matchType="type"/>

These attributes have the following definitions.

<Criterion>  attribute

Required

Description

property

The name attribute on the criteria entity. PolicyCenter uses this value to get the user's search term from the criteria entity.

matchType

This attribute is dependent on the data type of the targetProperty. See the following table for possible values.

forceEqMatchType

The name of a Boolean property on the criteria entity:

  • If this attribute evaluates to true, the Criterion uses an eq (equality) match.
  • If this attribute evaluates to false, the Criterion uses the matchType that the Criterion specifies to perform the match.

For example:

  <Criterion property="StringProperty"

             forceEqMatchType="FlagProperty"

             matchType="startsWith"/>

This code uses a startsWith match for StringProperty unless the FlagProperty on the criteria entity is true, in which case, the match uses an eq match type.

targetProperty

The name attribute on the entity on which to search.

IMPORTANT Do not use a virtual property on the entity as the search field.

The following list describes the valid matchType values. For String objects, matchType case-sensitivity depends on the database, except for startsWith and contains, which are always case-insensitive.

Match type

Evaluates to

Use with data type

Notes

contains

String

IMPORTANT Guidewire strongly recommends that you avoid using the contains match type, if at all possible. The contains match type is the most expensive type in terms of performance.

eq

equals

Numeric or Date

ge

greater than or equal

Numeric or Date

gt

greater than

Numeric or Date

le

less than or equal

Numeric or Date

lt

less than

Numeric or Date

startsWith

String

The startsWith match type is very expensive in terms of performance, second only to the contains match type. Use startsWith with caution.

Performance tuning for specific search criteria

For some searches, adding an index can improve performance. The exact index to add depends on the database that you use and the details of the situation. Whenever you change the search criteria by adding or modifying a <Criterion> subelement, ensure that appropriate indexes are in place. Guidewire recommends that you consult a database expert.

For example, suppose that you add a column that is the most restrictive equality condition in your search implementation. In this case, consider adding an index with this column as the leading key column.

Important: For performance reasons, Guidewire strongly recommends that you avoid the contains match type. The contains match type is the most expensive type in terms of performance.

Do not attempt to modify the required search properties

Guidewire divides the main search screens into required and optional sections. Guidewire has carefully chosen the properties in the required section to enhance performance. Therefore, do not change which properties are required properties. Adding your own required search criteria can cause performance issues severe enough to bring down a production database.

In addition, Guidewire has carefully chosen the match types of the existing required properties, due to restrictions on configuring fields on tables that are joined to the search table. Therefore, do not change the match types of existing required fields.

Warning: For performance reasons, Guidewire expressly prohibits the addition of new required fields or changing the match type of existing required fields in the PolicyCenter search screens.