How to implement search with hit highlight in Universal Viewer

265 views Asked by At

I have converted PDF files to JP2 images and showing them in Universal Viewer. Now, I want to implement search with hit highlight and autocomplete in Universal Viewer. One of the way I have found that I have to create annotations for it. I want the search functionality to work on all the texts inside. But, I am not being able to find a way to generate the annotations dynamically for all the texts. Please let me know how I can generate annotations dynamically for all the texts with positions from manifest.json.

Thanks.

1

There are 1 answers

0
Daniel-KM On

The texts to search and highlight are not defined in the manifest.json, that is designed only for the metadata and that is managed by IIIF Presentation API.

The search is managed via the IIIF Content Search API, that is another endpoint that you indicate as a service inside the manifest.json. In this second endpoint, you can add a process to convert results to the query into zones to highlight from a prepared text (generally an xml extracted from ocr).