ConnectorLib Java 25.2
ConnectorLib Java SDK Programming Guide

# Indexes

If your connector frequently uses filters based on the value of one column, you can significantly increase the speed of queries by creating an index. To create an index for the Reference column of a table, use the following code:

           datastore.createIndex("Documents", new String[] { "Reference"});

After the index has been created it is maintained automatically, and used automatically by any filters that filter on the relevant column. Calling `createIndex` when an index already exists is harmless, so typically it is called immediately after `createTable`, regardless of whether the table had to be created or already existed. Although it is not necessary to create an index, doing so can significantly improve performance, at the cost of a larger datastore file.

If the connector frequently uses a filter involving multiple columns, you can create a multi-column index. For example, if you expect to frequently use a filter for items that have a particular reference and were modified on a particular date you could use the following code:

           datastore.createIndex(
                       "Documents",
                       new String[] { "Reference", "LastModified" });

Note that this does not create an index for filtering by the Reference column and an index for filtering by the LastModified column, but an index for filtering by both columns together.

You can use repeated calls to ``createIndex`` to make as many indexes as you like, though each index will increase the size of the datastore file. Filters can be used without an index, but will be slower.

Copyright 2025 Open Text
Version 25.2 | Last updated April 2025

Send documentation feedback

Close

Send documentation feedback

To send feedback using your default email client, open an email window.

Otherwise, send your feedback and the information below to MFI-swpdl.idoldocsfeedback@opentext.com.

We appreciate your feedback!

Product: Knowledge Discovery ConnectorLib Java 25.2

Topic Title: Indexes