MIrador Fails on Simple Search
thanneken opened this issue · comments
Search within is failing in Mirador with the following in console:
Uncaught TypeError: Cannot read property 'total' of undefined
at $.SearchWithinResults.displayResultCounts (mirador.js:44062)
at Object.<anonymous> (mirador.js:44047)
at i (mirador.js:4)
at Object.fireWith [as resolveWith] (mirador.js:4)
at A (mirador.js:6)
at XMLHttpRequest.<anonymous> (mirador.js:6)
I can see the request received in the Jetty console, and the response is:
curl -i http://december16:8888/search-api/MilanWinter2017/search?q=search
HTTP/1.1 200 OK
Content-Type: application/ld+json; charset=UTF-8
Access-Control-Allow-Origin: *
Access-Control-Allow-Headers: X-Requested-With,Content-Type
Access-Control-Allow-Methods: GET,PUT,POST,DELETE
Content-Length: 666
Server: Jetty(6.1.26)
{
"@type" : "sc:AnnotationList",
"resources" : [ {
"@id" : "http://december16:8888/annotation/1528911196020",
"@type" : "oa:Annotation",
"dcterms:created" : "2018-06-13T12:33:16",
"resource" : [ {
"@id" : "_:b2",
"@type" : "dctypes:Text",
"http://dev.llgc.org.uk/sas/full_text" : "search term",
"format" : "text/html",
"chars" : "<p>search term</p>"
} ],
"on" : "http://december16/iiifp-dec16/MilanWinter2017/canvas/Group#null",
"motivation" : [ "oa:commenting" ],
"@context" : "http://iiif.io/api/presentation/2/context.json"
} ],
"@context" : "http://iiif.io/api/presentation/2/context.json"
}
Comparing that response to the Search API 1.0, I see that it matches the "simple list" format except for the annotationlist "@id". The property "total" is part of the "paging results" response, not the "simple list" response. Do any of these observations suggest a solution?
Fixed in the mirador-2.1.4 branch.