Obtaining a list of the values in an index
Using indexed value queries to retrieve a list of values in a specified index.
IxiaDocBaseServices docbase = ...
This object specifies the document base whose indexes you wish to search.
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>
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>
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>
To search a document base for a list of indexed values:
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.