Configuring Sun Master Indexes

Creating a Master Index Basic Query

By default, two basic queries are predefined in query.xml, one phonetic and one exact alphanumeric. If the default queries do not meet your query requirements, you can define new queries for the master index application. You can either use an existing query builder class or create a custom query builder by creating a custom plug-in (for more information, see Custom Plug-Ins for Master Index Custom Components in Developing Sun Master Indexes ).

The changes you make on the Query page of the Configuration Editor are reflected in query.xml. For more information about this file and the configurable query options, see Query Configuration in Understanding Sun Master Index Configuration Options . If you create a new query to use from the MIDM, make sure to add that query to one of the search definitions in midm.xml. Unless specifically defined for range searching in midm.xml, basic queries use exact searching. No configuration is required in query.xml for basic exact or range searching.

You can create basic queries either through the Configuration Editor or by modifying the XML file directly. Both methods are described here.

ProcedureTo Create a Basic Query (Configuration Editor)

  1. In the Projects window, right-click the Configuration node in the project you want to modify, and then click Edit.

    The Configuration Editor appears.

  2. Click the Query tab.

    The Query page appears.

  3. In the Basic Queries section, click Add.

    The Basic Query Builder dialog box appears.

  4. Enter values and select options for the fields described in Master Index Query Builder Dialog Box Fields and XML Elements.

  5. On the Configuration Editor toolbar, click Save.

ProcedureTo Create a Basic Query (XML Editor)

  1. In the Projects window, expand the Configuration node in the project you want to modify, and then double-click query.xml.

    The file opens in the NetBeans XML editor.

  2. Create a new query-builder element in the QueryBuilderConfig element.

    Make sure the new element is created outside of any existing query-builder elements.

  3. For the new query-builder element, define the attributes listed in Master Index Query Builder Dialog Box Fields and XML Elements.

    For example:


    <query-builder name="PHONETIC-SEARCH" class=
      "com.sun.mdm.index.user.CustomQueryBuilder" 
      parser-class= 
      "com.sun.mdm.index.configurator.impl.querybuilder.KeyValueConfiguration"
       standardize="false" phoneticize="true">
    </query-builder>
  4. To configure the query to use wildcard characters, do the following:

    1. Add a new config element after the opening query-builder element.

      For example:


      <query-builder name="ALPHA-SEARCH" class=
        "com.sun.mdm.index.querybuilder.BasicQueryBuilder"
        parser-class=
        "com.sun.mdm.index.configurator.impl.querybuilder.KeyValueConfiguration"
        standardize="true" phoneticize="true">
         <config>
         </config>
      </query-builder>
  5. In the new config element, create an option element and then define key and value attributes for the new element.

    For example:


    <config>
     <option key="UseWildcard" value="true"/>
    </config>

    Note –

    For the default basic query, only the UseWildcard parameter is supported. If you create a custom basic query builder, you can use these elements to define additional parameters. For more information, see Master Index Query Builder Dialog Box Fields and XML Elements.


  6. Save and close the file.

Master Index Query Builder Dialog Box Fields and XML Elements

The following table lists and describes the fields on the Basic Query Builder and Blocking Query Builder dialog boxes on the Configuration Editor, along with the corresponding elements and attributes in query.xml.

Configuration Editor Field 

XML Element/Attribute 

Description 

Query Builder Name

query-builder/name 

A unique ID that identifies the Query Builder and is referenced from midm.xml when specifying the query to use on a search page. It is also referenced from mefa.xml when specifying the query to use for matching. No spaces are allowed in the name. 

Query Builder Class

query-builder/class 

The fully qualified name of the query class. Two default Query Builder classes are provided. 

  • com.sun.mdm.index.querybuilder.BasicQueryBuilder – Builds dynamic queries using all the available input fields. When configured to use normalized and phonetic data, this query performs phonetic searches; when configured to not use normalized and phonetic data, this query is used for exact alphanumeric searches.

  • com.sun.mdm.index.querybuilder.BlockerQueryBuilder – Builds queries using the criteria defined in the block definitions defined for the query. When a blocking query is performed, the application searches only on the blocks for which they query has complete data.

Parser Class

query-builder/ parser-class 

The fully qualified name of the class that parses the configuration elements for each query. The default parser class is com.sun.mdm.index.configurator.impl.querybuilder. KeyValueConfiguration.

Standardize

query-builder/ standardize 

An indicator of whether any of the query criteria is standardized before being passed to the query. On the Configuration Editor, select this check box if any search fields are standardized. In the XML file, enter true if any search fields are standardized; otherwise enter false.

Phoneticize

query-builder/ phoneticize 

An indicator of whether any of the query criteria is phonetically encoded before being passed to the query. On the Configuration Editor, select this check box if any search fields are phonetically encoded. In the XML file, enter true if any search fields are phonetically encoded; otherwise enter false.

Use Wildcard 

option/key 

option/value 

An indicator of whether wildcard characters are allowed when executing this search. This parameter is available for basic queries only. On the Configuration Editor, select this check box if wildcard characters are allowed in any of the search fields.  

In the XML file, each option element configures one parameter for the query and contains a key and value pair. The key attribute names the parameter. For the default basic query, the name is UseWildCard. The value attribute specifies the value of the corresponding key attribute. For the UseWildCard parameter, specify true to allow wildcard characters for that query type; otherwise specify false.

When wildcard characters are enabled, you can enter a percent sign (%) into search criteria to represent multiple unknown characters. 


Note –

If you define a custom query, you can use key and value options to define any required parameters.