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.
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? | Switch <verbose> to true in the configuration file:
<config xmlns="http://hcmc.uvic.ca/ns/staticSearch">
<params> <!--....--> <verbose>true</verbose> <!--....--> </params> <!--Rules, etc--> </config> |
How can I get staticSearch to jump straight to a specific hit in the document from a search result? | The best way to do this is to ensure that <linkToFragmentId> is set to the true and that the input HTML contains ids at whatever level you think is most helpful. For instance, if possible, you could give each <xhtml:p> element an id, which would mean that each KWIC could be linked to the right paragraph in the input document. |