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.
In the Projects window, right-click the Configuration node in the project you want to modify, and then click Edit.
The Configuration Editor appears.
Click the Query tab.
The Query page appears.
In the Basic Queries section, click Add.
The Basic Query Builder dialog box appears.
Enter values and select options for the fields described in Master Index Query Builder Dialog Box Fields and XML Elements.
On the Configuration Editor toolbar, click Save.
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.
Create a new query-builder element in the QueryBuilderConfig element.
Make sure the new element is created outside of any existing query-builder elements.
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> |
To configure the query to use wildcard characters, do the following:
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> |
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> |
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.
Save and close the file.
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.