Package org.sentrysoftware.maven.skin
Class IndexTool
java.lang.Object
org.apache.velocity.tools.generic.SafeConfig
org.sentrysoftware.maven.skin.IndexTool
@DefaultKey("indexTool")
public class IndexTool
extends org.apache.velocity.tools.generic.SafeConfig
indexTool is a reference-able in a Velocity template.
It creates the elasticlunr index of the specified HTML content.
-
Field Summary
Fields inherited from class org.apache.velocity.tools.generic.SafeConfig
LOCK_CONFIG_KEY, LOGGER_NAME_KEY, SAFE_MODE_KEY, USE_CLASS_LOGGER_KEY
-
Constructor Summary
Constructors -
Method Summary
Methods inherited from class org.apache.velocity.tools.generic.SafeConfig
configure, isConfigLocked, isSafeMode
-
Constructor Details
-
IndexTool
public IndexTool()Creates a new instance
-
-
Method Details
-
buildElasticLunrIndex
public void buildElasticLunrIndex(String indexPathString, String id, String title, String keywords, String body) throws IOException, ScriptException, NoSuchMethodException Builds and update the specified elasticlunr.js index.If the specified elasticlunr.js index file doesn't exist, it will be created. Otherwise, it will be updated with the specified document.
The elasticlunr.js index file is the JSON-serialized index that needs to be loaded into elasticlunr.js with:
elasticlunr.Index.load(indexJson);
This uses http://elasticlunrjs.com version 0.9.5.
- Parameters:
indexPathString
- Path to the JSON-serialized elasticlunr.js indexid
- ID of the document to add/update (typically it's URL)title
- Title of the documentkeywords
- Keywords of the document (separated with any non alphabetical characters)body
- Content of the document to be added to the index- Throws:
IOException
- when cannot read or write the index fileScriptException
- when anything bad happens with the Javascript (should never happen except when developing)NoSuchMethodException
- when developer broke the Javascript code
-