Skip to content

Latest commit

 

History

History
50 lines (37 loc) · 2.42 KB

File metadata and controls

50 lines (37 loc) · 2.42 KB

Annotorious ElasticSearch Plugin

A simple Annotorious plugin that stores annotations on an ElasticSearch server. This plugin is meant primarily for demo purposes, and as an example for those interested in building their own storage plugins. I strongly advise against using this plugin in any kind of production environment. (Contributions to make it production ready are always welcome though ;-)

This plugin is licensed under the WTFPL.

Using this Plugin

Simply download the script, copy it to your server/Webspace and set it up with your page as described below.

  1. The plugin uses jQuery. Therefore you need to import jQuery before importing the plugin script.
  2. Add the plugin script to your page just like any other Annotorious plugin. Make sure the plugin script is loaded after the main Annotorious script.
  3. Attach the plugin to Annotorious using the anno.addPlugin API method.
  4. Specify the base URL of the ElasticSearch server using a base_url config param.

Example

....
  <head>
    <!-- Import main Annotorious script and CSS -->
    <link rel="stylesheet" href="https://annotorious.github.com/latest/annotorious.css" type="text/css" />
    <script src="https://annotorious.github.com/latest/annotorious.min.js"></script>
    
    <!-- Import jQuery - the ElasticSearch plugin depends on it! -->
    <script src="jquery-1.9.0.min.js"></script>
    
    <!-- Import the plugin script -->
    <script src="my-scripts/anno-elasticsearch-plugin.js"></script>
    
    <!-- Use Annotorious' JavaScript API to attach and activate the plugin -->
    <script>
      anno.addPlugin('ElasticSearch', { base_url: 'http://www.my-es-server.com/annotations/' });
    </script>
  <head>
....

Hacking on this Plugin

There is a test page in this project at /test/test.html. Simply open this test page in your browser and you're ready to go.

A word of caution: the test page points to my dev ElasticSearch server. Feel free to use that to hack & test away. But be aware that I'm not making any guarantees in terms of uptime and availability. Also, I'm occasionally flushing the server which means annotations will be lost without notice.