The jhindexer Command

## The `jhindexer` Command

The `jhindexer` creates a full-text search database used by the JavaHelp system full-text search engine to locate matches. You can use the `jhsearch` command to verify the validity of the database.

To build a full-text search database use the following commands:

Win32

        jhindexer [options] [file | folder]*

Solaris/SPARC

        jhindexer [options] [file | folder]*

If the argument is a folder, the folder is searched recursively for JavaHelp system content files.

The following options are available:

`-c` file | A configuration file name. See Config File below.
`-db` dir | The name of the database output folder. By default the output folder is named `JavaHelpSearch` and is created in the current folder.
`-locale` lang_country_variant | The name of the locale as described in `java.util.Locale`. For example: `en_US` (English, United States) or `en_US_WIN` (English, United States, Windows variant).
`-logfile` file | Captures `jhindexer` messages in a specified file. You can use this option to preserve `jhindexer` output on Win32 machines where the console window is dismissed after execution terminates.
`-nostop words` | Causes stop words to be indexed in the full-text search database.
`-verbose` | Displays verbose messages while processing.

### Stop Words

You can direct the JavaHelp system's full-text search indexer to exclude certain words from the database index. These words are called stop words. By default, the indexer ignores (does not index) the following stop words when it encounters them in your help topics:

    a     all    am    an    and   any    are   as
    at    be     but   by    can   could  did   do
    does  etc    for   from  goes  got    had   has
    have  he     her   him   his   how    if    in
    is    it     let   me    more  much   must  my
    nor   not    now   of    off   on     or    our
    own   see    set   shall she   should so    some
    than  that   the   them  then  there  these this
    those though to    too   us    was    way   we
    what  when   where which who   why    will  would
    yes   yet    you

You can override the indexer's default stop word behavior in two ways:

- Use the `-nostopwords` option with the `jhindexer` command to force the indexer to ignore stop words and to index every word in your help topics.
- Use the `config` file to specify your own list of stop words.

### `Config` File

You can use the `config` file to:

- Change the path names of the files as they are stored in the search database. Use this option when you create the search database with paths to topic files that are different from the paths the help system will later use to find them.
- Explicitly specify the names of the topic files you want indexed.
- Specify your own list of stop words.

Each of these options is described below.

#### Changing Path Names

You can remove and prepend portions of the topic file names as they are stored in the search database. This is useful when the path to the topic files you use during development is different from the path the help system will later use to find the topic files during searches.

To remove a portion of the path name from all of the indexed files:

Add the following line to the `config` file:

        IndexRemove path

where path is the portion of the path you want removed.

For example, to change:

        /public_html/JavaHelp/demo/docs/file.html

to:

        docs/file.html

add the following line to the `config` file:

        IndexRemove /public_html/JavaHelp/demo/

To prepend a different path to the indexed files:

Add the following line to the `config` file:

        IndexPrepend path

For example, to change:

        docs/file.html

to:

        my_product/install/docs/file.html

add this line to the `config` file:

        IndexPrepend my_product/install/

#### Specifying Files for Indexing

You can explicitly specify the names of the files you want indexed. In the `config` file, specify the names in a list in the following format:

        File filename
        File filename
        File filename
              .
              .
              .

Be sure to use "/" as the file separator when specifying files for indexing.

#### Specifying Stop Words

You can specify your own list of stop words in the `config` file. When you specify your own list, the indexer does not use the default stop word list. You can specify a list of stop words in two ways:

- Add the list of words directly to the `config` file. Use the following format:

          StopWords word, word, word...

- In the `config` file, specify the name of a file that contains a list of stop words:

          StopWordsFile filename

  The stop words file must list each stop word on its own line.

See also:

  Creating the Full-Text Search Database
  The `jhsearch` Command
  Localizing the Full-Text Search Database