Obtaining a list of the values in an index

Using indexed value queries to retrieve a list of values in a specified index.

Your program must be connected to a docbase, and your program must have an IxiaDocBaseServices object for that docbase:
IxiaDocBaseServices docbase =   ...

This object specifies the document base whose indexes you wish to search.

Also, your program must define a string that contains the index query:
String query =    ...

This topic explains how to use indexed value queries to search a document base and retrieve a list of the values stored in one or more specified indexes. The list of values is sometimes called a dictionary.

Index queries can be stored as files or even as documents in your docbase, but you must pass them as strings to the method that searches the indexes.

GetAllIndexedValuesForOneIndex.xml is a sample query that retrieves a dictionary of all values of the Page index. You can run it against the sample docbase:

<?xml version="1.0" encoding="UTF-16"?>
<!-- GetAllIndexedValuesForOneIndex.xml -->
<query VERSION="4.5" >
    <key NAME="Page">
        <elem><anystr/></elem>
    </key>
</query>
Note: Do not confuse an indexed value query and a document query: a document query retrieves documents, not values. One way to tell them apart: an indexed value query cannot have a RESULTSPACE attribute.

You can restrict your search to a range of values, e.g., to a range of dates. An example of this is GetIndexed ValuesWithinARange.xml:

<?xml version="1.0" encoding="UTF-16"?>
<!-- GetIndexed ValuesWithinARange.xml -->
<query VERSION="4.5">
    <key NAME="Date">
        <interval>
            <start INCLUSIVE="True">
                <date>
                    <year>2000</year>
                    <month>7</month>
                    <day>3</day>
                </date>
            </start>
            <end INCLUSIVE="True">
                <date>
                    <year>2000</year>
                    <month>10</month>
                    <day>1</day>
                </date>
            </end>
        </interval>
    </key>
</query>
Note:

Indexed value queries must conform to SEARCH_INDEX.DTD, which is a system document.

AllSystemDocuments.xml (not shown) is a sample query that retrieves all the system documents in any docbase. (See also AllNonSystemDocuments.xml, that retrieves all the "ordinary" documents in any docbase).

The result of a search using an indexed value query is a list of values that is coded as XML. Here is the (manually reformatted) dictionary that is retrieved by running SampleSearchIndexQuery.xml against the sample docbase:

<?xml version='1.0' encoding='UTF-16' ?><result VERSION = "4.5">
<key NAME = "Date">
<list>
    <elem OCC_COUNT = "10" DOC_COUNT = "10">
        <date>
            <year>2000</year>
            <month>7</month>
            <day>3</day></date
    ></elem>
    <elem OCC_COUNT = "14" DOC_COUNT = "14">
        <date>
            <year>2000</year>
            <month>9</month>
            <day>19</day>
        </date>
    </elem>
</list>
</key>
</result>
Note: Use SEARCH_INDEXRESULT.DTD to parse the results of running an indexed value query.

To search a document base for a list of indexed values:

  1. Get an IxiaSearchServices object using the IxiaSearchServices() method of docbase, the IxiaDocBaseServices object.
    IxiaSearchServices search = docbase.SearchServices();
    The IxiaSearchServices() method provides access to the services available for searching the specified document base.
  2. Define a string that contains the index query:
    String query =    ...
  3. Use the IxiaSearchServices object and the query string to search the indexes of the docbase:
    // Search the specified docbase with the
    // specified query. Store the results in a string.
    String result = search.SearchIndexes(query);
    The result string is the XML containing the results of the search.
    Note: Instead of writing a program, you can use TEXTML Console to run indexed value queries (as well as document queries).

All sample queries are located in your Program Files directory for TEXTML Server: [...]\IxiaSoft\TextmlServer[version]\SDK\Queries\*.xml.

Here is the sample program for running indexed value queries: [...]\IxiaSoft\TextmlServer[version]\SDK\java\com\ixiasoft\samples\SearchIndexes.java.