Schema and guidelines for creating a staticSearch engine for your HTML5 site
Martin Holmes
Joey Takeda
2019–2026

This documentation provides instructions on how to use the Project Endings staticSearch Generator to provide a fully-functional search ‘engine’ to your website without any dependency on server-side code such as a database.

10 ‘How do I...’

Below are some of the most common things you might want to do using staticSearch:

How do I get staticSearch to ignore large chunks of my document? Any element with a weight of 0 is ignored completely by the indexer, so add a <rule> for the element. So to ignore all elements with the class ignoreThisElement, you could do something like:
<rule weight="0"
match="div[contains-token(@class, 'ignoreThisElement')"/>
How do I get staticSearch to ignore small inline bits and not have them in the KWIC? As above, you can use a <rule> with an weight=0
How do I get staticSearch to ignore an element, but retain its text in the KWIC? Here, you'll want to use the <exclude> function, which excludes the element from indexing, but doesn't remove it from the document itself. So, if you wanted to exclude all keyboard entry items (<xh:kbd>), but still have them in the KWIC, you could do something like:
<exclude match="kbd"
type="index"/>
How can I get staticSearch to show debugging messages? Set the ssVerbose property to true at the command line:
ant -DssConfig=cfg.xml -DssVerbose=true 
Note that verbosity settings persist after creating the initial config; so, if you are trying to debug just the tokenization process, you must make sure to run the config target beforehand:
ant config tokenize -DssConfig=cfg.xml -DssVerbose=true 
How can I get staticSearch to highlight the found text in a target document? See Highlighting search hits on target pages.
How do I prevent staticSearch from encountering out of memory errors? If you are indexing a very large collection of files, you may need to provide ant with additional memory by configuring the ANT_OPTS system property. To provide ant with 4GB of memory, you could do something like so:
export ANT_OPTS="-Xmx4g"; ant -DjavaFork=false -DssConfigFile=/absolute/path/to/your/config.xml
How much memory you can and should provide to Ant depends on your particular system and the size of the document collection. See Ant's documentation for some further examples and explanation. The javaFork parameter prevents calls to Java processes (such as Saxon) from forking into a new Java VM, which allows them to take advantage of the expanded memory you have assigned to Ant.
Martin Holmes and Joey Takeda. Date: 2019–2026