< STML parsing | Hotkeys > |
HelpSet fulltext-search index creation is done in the createHelpsetSearchIndex() method of helpsetmaker.engine.OutputCreationThread.
The JavaHelp bundle contains the jhindexer command which knows about creating the index database for the helpset. The command itself is a shell script which does nothing more than executing a suspiciously small JAR file. That JAR file contains nothing more than a manifest file. That file loads jhall.jar into the classpath and executes the com.sun.java.help.search.Indexer class.
Unfortunately, Indexer is not documented. The public signature of the class, however, does indicate rather clearly what is going on. Beside some arbitrary stuff, there is
the static main(String[] arg0) method
a non-parameter constructor
a non-static compile(String[] arg0) throws Exception method
Reasoning how I would program such a thing (and how I already did that in similar cases), I decided to go like this with that class:
static Indexer indexer;
String[] args=new String[] {
“-c”,configfile.getAbsolutePath(),
”-db”,<directory specification>,
”-verbose”};
if (indexer==null) indexer=new Indexer();
indexer.compile(args);
Even though totally undocumented, this works like a charm. The configuration file is created as temporary file on the fly. As the base dir is unspecified during the invocation of the Indexer class, all configuration must use absolute path names. Therefore, the IndexRemove option for the configuration file is important.
Restriction of index creation to those files marked that way (“”) happens simply though the File directive in the configuration file.
Note that you must use a static instance of Indexer as otherwise you are trapped by a nasty bug within Sun's Indexer code. If you reinstanciate Indexer more than once within a Java Virtual Machine, the second and any further run do not produce anything useful but bunches of “ConfigFile and/or IndexBuilder not set”-exceptions.
< STML parsing | Hotkeys > |