[annotator-dev] Lazy loading annotations

Head, Michael mhead at live.unc.edu
Tue Jul 22 01:25:50 UTC 2014


Hi,

I’m working on a research project that uses Annotator to display annotations on academic articles. I'm experiencing some slowness when loading hundreds of annotations on a page. My research advisor is hoping the proof of concept we’re working on can scale up for hundreds of annotators with thousands of annotations. 

The code currently loads in all the annotations via an AJAX request after the page loads. The response is a 1.1MB JSON file that takes a while to parse. I have been trying to find a way to lazy load annotations in on scroll and I was wondering if something like this currently exists. Searching Google, this developer thread, and looking over Github issues hasn’t worked for me so far. 

I thought using a small Limit in the query would work fine, but querying that way returns the last X annotations that were created, which may be scattered anywhere in the viewport (in view or out of view of the user). What I’m trying to do is load only those annotations that should be in the current viewport, plus maybe a few more. 

Is there any way to do this that currently exists or would this require adding position (pixel offset) information to each annotation so that I can order by that when querying with a limit? 

Thank you,
Michael Head


More information about the annotator-dev mailing list