Configuring connections with the Guidewire Solr Extension

You configure instances of the Guidewire Solr Extension and how PolicyCenter connects with them in the solrserver-config.xml file. Two XML elements help in this type of configuration: the <document> element and the <solrserver> element.

The <document> element

In solrserver-config.xml, for each type of index document, such as policy data, a <document> element associates that data type with an instance of the Guidewire Solr Extension. For example:

<document name="policy" servername="my_solr_instance"/>

The servername attribute specifies a < solrserver> element defined elsewhere in the solrserver-config.xml file.

The base configuration includes <document> elements for each type of data that free-text search supports. You must modify the servername attribute to match the instances of the Guidewire Solr Extension that you define and use.

The <solrserver> element

In solrserver-config.xml, for each instance of the Guidewire Solr Extension, a <solrserver> element defines its type of operation and how PolicyCenter connects with it.

<solrserver name="name" type={"embedded"|"http"|"cloud"} [env="env-variable-value[, env-variable-value-2]"]>

The servername attributes of <document> elements must match the name attributes of <solrserver> elements. You can map more than one <document> element to the same <solrserver> element.

The type attribute specifies the operating mode for the Guidewire Solr Extension. The attribute has three possible values:

  • embedded – The Guidewire Solr Extension operates embedded within PolicyCenter.
  • http – The Guidewire Solr Extension operates externally from PolicyCenter, as a single server.
  • cloud – The Guidewire Solr Extension operates externally from PolicyCenter, as a cluster of servers.

The env attribute contains one or more values representing Guidewire Solr Extension environments. One of these environments must be present for the <document> element to match the instant <solrserver> element.

The base configuration includes <solrserver> elements that serve as examples for the <solrserver> elements that you must define.

The env attribute

In solrserver-config.xml, the <document>, <solrserver>, and <param> elements support the env attribute.

During the development and testing of your implementation of free-text search, you often switch between different instances of the Guidewire Solr Extension. For example, you may use the server in embedded mode for your own unit testing and a local or remote server instance for system testing. To switch between server instances, you can change the servername attribute in solrserver-config.xml to reference the <solrserver> element for the instance that you want to use.

However, switching between server instances by editing solrserver-config.xml can be tedious. As an alternative, use the env attribute on <document> elements for the same index document type. Using the env attribute and multiple <document> elements will allow you to associate each index document type with several different server definitions. The value of the server environment variable and its matching env attribute value determine which <document> element and server definition are active at a given time.

The benefit of the env attribute is that instead of having to edit the solrserver-config.xml file every time you need to switch between server instances, you can simply change the value of the server environment variable. When you make such a change, the env attribute that has a value matching the environment variable value switches the active server instance.

For an example of using the env attribute, suppose that the solrserver-config.xml file contains the following document definitions:

<document name="policy" archive="false" servername="embedded"/>
<document name="policy" archive="false" servername="localhttp" env="local"/>

In this example, PolicyCenter runs with the embedded server by default. PolicyCenter does so for two reasons. The first reason is because the PolicyCenter base configuration does not have a setting for its Java VM environment variable. The second reason is because the <document> element associated with an embedded server has the same name and no setting for its env attribute.

To run PolicyCenter with the external server hosted locally instead, start PolicyCenter with the Java VM environment variable -Dgw.pc.env=local. In this case, PolicyCenter looks for the <document> element with the same name and with an env attribute having a value of “local.” The <document> element that has these characteristics corresponds to an external server hosted locally.