Search and Index Essentials
Indexing Multiple PDF Documents
11
Indexing Multiple PDF Documents
It is possible to extend and customize indexes for multiple PDF documents using the
Acrobat JavaScript
catalog
,
catalogJob
, and
index
objects. These objects may be
used to build, retrieve, or remove indexes. The
index
object represents a
catalog
-
generated index, contains a
build
method that is used to create an index (and returns a
catalogJob
object containing information about the index), and has the properties
shown below in
Table 11.3:
T
ABLE
11.3
Index Properties
Property
Description
Indicates whether an index is available
The name of the index
The device-independent path of the index
Indicates whether the index will participate in the search
available
name
path
selected
The
catalog
object may be used to manage indexing jobs and retrieve indexes. It
contains a
getIndex
method for retrieving an index, a
remove
method for removing a
pending indexing job, and properties containing information about indexing jobs.
Creating, Updating, or Rebuilding Indexes
To determine which indexes are available, use the
search
object’s
indexes
property,
which contains an array of
index
objects. For each object in the array, you can determine
its name by using its
name
property. In the code below, the names and paths of all available
selected indexes are printed to the console:
var arr = search.indexes;
for (var i=0; i<arr.length; i++)
{
if (arr[i].selected)
{
var str = "Index[" + i + "] = " + arr[i].name;
str += "\nPath = " + arr[i].path;
console.println(str);
}
}
Acrobat JavaScript Scripting Guide
197