You said you were using MongoDB + Node.js for your server. Did you write this yourself? Have you looked at this one: https://github.com/hyperstudio/MIT-Annotation-Data-Store ?
You need to return the totals and rows in your response to the search on the server. On Mon, Mar 9, 2015 at 7:11 PM, Gareth Highnam <[email protected]> wrote: > Do you see anything wrong with this post? If I look at the response (as > suggested by Shauna), this is what is returned by the loadFromSearch, but > nothing appears on the page itself. > > Also worth noting - there is no "totals" or "rows" object returned by > search, but the docs say they should be expected. > > [ { _id: 54fe3df73cd83186094364ad, > quote: 'are two solu', > uri: 'http://www.example.com/anno/anno.html', > id: 54fdd3ce6c8417cd71810cf9, > __v: 0, > permissions: [], > tags: [], > ranges: > [ { start: '/p[2]', > startOffset: 22, > end: '/p[2]', > endOffset: 35, > _id: 54fe3df73cd83186094364ae } ], > text: 'do this', > updated: Mon Mar 09 2015 20:42:31 GMT-0400 (EDT), > created: Mon Mar 09 2015 20:42:31 GMT-0400 (EDT) } ] > > On Mon, Mar 9, 2015 at 9:02 PM, Randall Leeds <[email protected]> wrote: > >> No. Annotator will use the "id" field for substitution in the URL, >> though. It's important that it be accurate. Annotator will completely >> ignore _id. >> >> On Mon, Mar 9, 2015 at 6:47 PM, Gareth Highnam <[email protected]> >> wrote: >> >>> One more question - will it break things if there is both an "_id" field >>> and a "id" field for each entry (and they are identical)? >>> >>> >>> >>> On Mon, Mar 9, 2015 at 6:04 PM, Gareth Highnam <[email protected]> >>> wrote: >>> >>>> I did create a new "id" field that copied "_id", although now that I >>>> look at it I ended up copying _id from ranges and not the main one, which >>>> may be an issue. I'll see what happens if I fix that. >>>> >>>> As for the URI, it actually does match, but I changed it by hand in the >>>> email (because my friend is paranoid). Sorry for the confusion there, good >>>> catch though! >>>> >>>> On Mon, Mar 9, 2015 at 5:40 PM, Randall Leeds <[email protected]> >>>> wrote: >>>> >>>>> Looking good. Annotator Store expects the id key to be named "id". You >>>>> may need to rewrite that key in your API routes. >>>>> On Mar 9, 2015 3:13 PM, "Gareth Highnam" <[email protected]> wrote: >>>>> >>>>>> This time it gave 200 and gave me some JSON about my existing >>>>>> entries, which are a bunch data like so: >>>>>> >>>>>> {"_id":"54fdf51f18eb23d57f4a8ca6","quote":"are two solut","uri":" >>>>>> http://localhost.com/inline/anno.html >>>>>> ","__v":0,"permissions":[],"tags":[],"ranges":[{"start":"/p[2]","startOffset":22,"end":"/p[2]","endOffset":36,"_id":"54fdf51f18eb23d57f4a8ca7"}],"text":"adsf","updated":"2015-03-09T19:31:43.016Z","created":"2015-03-09T19:31:43.016Z","id":"54fde1dbf7d884cc7862b346"},09T21:57:53.240Z","id":"54fde1dbf7d884cc7862b346"}] >>>>>> >>>>>> I'm not really sure if these posts are created correctly in first >>>>>> place, which could be a big issue but there are no explicit errors from >>>>>> Annotator about it. >>>>>> >>>>>> Thanks, >>>>>> Gareth >>>>>> >>>>>> On Mon, Mar 9, 2015 at 5:00 PM, Shauna Gordon-McKeon < >>>>>> [email protected]> wrote: >>>>>> >>>>>>> I missed that Annotator is successfully POSTing entries. That >>>>>>> narrows things down. >>>>>>> >>>>>>> What url is it GETing from? When it returns 200 or 304, can you use >>>>>>> the "Network -> Response" element of the developer console to inspect >>>>>>> what >>>>>>> it's returning? >>>>>>> >>>>>>> On Mon, Mar 9, 2015 at 5:55 PM, Gareth Highnam <[email protected]> >>>>>>> wrote: >>>>>>> >>>>>>>> Thanks Shauna, >>>>>>>> >>>>>>>> When the loadFromSearch runs, it returns either a 304 or 200 type >>>>>>>> error. Because of this, it does not report anything to the developer >>>>>>>> console. Why it does one or the other I still don't know... You may be >>>>>>>> onto something with the port issues though. >>>>>>>> >>>>>>>> The confusing part is the lack of obvious errors. Store seems to >>>>>>>> POST fine, but does not GET from search even with a 200 error. >>>>>>>> >>>>>>>> Gareth >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> On Mon, Mar 9, 2015 at 4:40 PM, Shauna Gordon-McKeon < >>>>>>>> [email protected]> wrote: >>>>>>>> >>>>>>>>> I'm an Annotator newb too, but a few things I notice: >>>>>>>>> >>>>>>>>> - You've given a full path when specifying the endpoint. In my >>>>>>>>> (working) version I just specify the prefix, in my case '/api' >>>>>>>>> >>>>>>>>> - You've specified :3000 for the api endpoint but not for the >>>>>>>>> URIs. If the whole app is accessed via port 3000 this may cause >>>>>>>>> problems. >>>>>>>>> >>>>>>>>> - You've got a term search: '/search' here which I don't have. >>>>>>>>> This could totally be a working different implementation from mine, >>>>>>>>> but I >>>>>>>>> thought I'd flag it as a potential problem. I've put my code >>>>>>>>> here in case it's helpful to look through: >>>>>>>>> https://pastebin.mozilla.org/8824977 >>>>>>>>> >>>>>>>>> Maybe try switching the above things around and see if it starts >>>>>>>>> working? >>>>>>>>> >>>>>>>>> When debugging problems, I use the developer console that >>>>>>>>> Chrome/Firefox provide. You can see network requests there. >>>>>>>>> Annotator >>>>>>>>> should be making a request to the API store -- what is the response >>>>>>>>> from >>>>>>>>> the API? 404 (not found)? 403 (forbidden)? Or is it breaking >>>>>>>>> before it >>>>>>>>> even makes a request? >>>>>>>>> >>>>>>>>> best >>>>>>>>> Shauna >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> On Mon, Mar 9, 2015 at 5:09 PM, Gareth Highnam < >>>>>>>>> [email protected]> wrote: >>>>>>>>> >>>>>>>>>> I've been tying to set up local storage with the storage plugin, >>>>>>>>>> using Node.js+MongoDB. My end goal is for anyone visiting my page to >>>>>>>>>> be >>>>>>>>>> able to annotate it and view any existing annotations previously >>>>>>>>>> made, when >>>>>>>>>> the page loads. I don't need any authentication for this purpose. >>>>>>>>>> >>>>>>>>>> Disclaimer: (I am a noob) >>>>>>>>>> >>>>>>>>>> Here is where I am: >>>>>>>>>> 1. Page loads, annotator can highlight, create, edit, delete >>>>>>>>>> comments on front end. >>>>>>>>>> 2. Annotator POST can create entries in back end. >>>>>>>>>> >>>>>>>>>> When I reload page, no stored annotations are brought up, despite >>>>>>>>>> existing in backend. Here is the code for the storage set up: >>>>>>>>>> >>>>>>>>>> var content = $('div').annotator(); >>>>>>>>>> >>>>>>>>>> content.annotator('addPlugin', 'Store', { >>>>>>>>>> >>>>>>>>>> // The endpoint of the store on your server. >>>>>>>>>> prefix: ' >>>>>>>>>> http://www.nofeveryone.com:3000/inline', >>>>>>>>>> >>>>>>>>>> // Attach the uri of the current page to all >>>>>>>>>> annotations to allow search. >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> annotationData: { >>>>>>>>>> >>>>>>>>>> 'uri': 'http://www.nofeveryone.com/anno/anno.html' >>>>>>>>>> >>>>>>>>>> }, >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> // This will perform a "search" action when the >>>>>>>>>> plugin loads. Will >>>>>>>>>> >>>>>>>>>> // request the last 20 annotations for the current >>>>>>>>>> url. // eg. >>>>>>>>>> /store/endpoint/search?limit=20&uri=http://this/document/only >>>>>>>>>> loadFromSearch: { >>>>>>>>>> >>>>>>>>>> 'limit': 20, >>>>>>>>>> >>>>>>>>>> 'uri': 'http://www.nofeveryone.com/anno/anno.html >>>>>>>>>> ' >>>>>>>>>> >>>>>>>>>> }, >>>>>>>>>> >>>>>>>>>> urls: { >>>>>>>>>> >>>>>>>>>> search: '/search' >>>>>>>>>> >>>>>>>>>> } >>>>>>>>>> >>>>>>>>>> }); >>>>>>>>>> >>>>>>>>>> The API endpoints appear fully functional. When I test the same >>>>>>>>>> http requests from my URI using curl, I get my posts back in JSON. >>>>>>>>>> >>>>>>>>>> I've been pretty stumped for why it's not loading them with >>>>>>>>>> "loadFromSearch", so if anyone thinks they can help I would greatly >>>>>>>>>> appreciate it. I'm happy to give any other info about my code. >>>>>>>>>> >>>>>>>>>> Gareth >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> _______________________________________________ >>>>>>>>>> annotator-dev mailing list >>>>>>>>>> [email protected] >>>>>>>>>> https://lists.okfn.org/mailman/listinfo/annotator-dev >>>>>>>>>> Unsubscribe: https://lists.okfn.org/mailman/options/annotator-dev >>>>>>>>>> >>>>>>>>>> >>>>>>>>> >>>>>>>> >>>>>>> >>>>>> >>>>>> _______________________________________________ >>>>>> annotator-dev mailing list >>>>>> [email protected] >>>>>> https://lists.okfn.org/mailman/listinfo/annotator-dev >>>>>> Unsubscribe: https://lists.okfn.org/mailman/options/annotator-dev >>>>>> >>>>>> >>>> >>> >> >
_______________________________________________ annotator-dev mailing list [email protected] https://lists.okfn.org/mailman/listinfo/annotator-dev Unsubscribe: https://lists.okfn.org/mailman/options/annotator-dev
