# Pre-built documentation index

When user searches help contents of a product, the search is performed within a documentation index. By default, this index is created on the first invocation of help search, but can be pre-built and delivered to the user with a product. This avoids indexing from occurring on the user machine and lets user obtain first search results faster.

## Building an index for a product

To build an index follow the steps:

- build a product, including all documentation plug-ins,
- create an index for a desired locale by running this command:

      eclipse -nosplash -application org.eclipse.help.base.indexTool -vmargs -DindexOutput=outputDirectory -DindexLocale=locale

  from the directory containing the product. The following arguments need to be set :
  outputDirectory - specifies path of the directory where the index is to be saved
  locale - specifies locale for which the index will be built

For example, running

    eclipse -nosplash -application org.eclipse.help.base.indexTool -vmargs -DindexOutput=d:/build/com.my.plugin -DindexLocale=en

will result in file doc_index.zip being saved in the nl/en directory that will be created under d:/build/com.my.plugin. The zip will contain index of contents of documents that are available to users when they run the product in the en locale.

## Packaging and Installation of pre-built index

Pre-built indices, the doc_index.zip files, need to be packaged as a plug-in. You can choose to use a plug-in associated with the primary feature, or choose to package the index for each language into separate fragments.
For example, if product's documentation is available in three languages, say English, German and Simplified Chinese, a plug-in com.my.plugin can have the following structure:

    com.my.plugin/
                  plugin.xml
                  nl/
                     de/
                        doc_index.zip
                     en/
                        doc_index.zip
                     zh/
                        CN/
                           doc_index.zip
                  other files of this plugin

The ID of the plugin needs to be specified as a productIndex preference for org.eclipse.help.base plugin. For plugin in the above example, the plugin_customization.ini file needs to contain the entry

    org.eclipse.help.base/productIndex=com.my.plugin