COMPLETED TASK: Enhancement to search
It would be useful to add a new drop-down list to the search screen enabling the user to choose to search only within specific annotation categories. (Obviously this search would be limited to images). One great advantage of this would be that we could retrieve sets of annotations, and it would be possible also to pull back thumbnails of the images themselves, so you could look at (for instance) all chickens appearing in the images.
I've spent a little time thinking about this, and there are a few issues to decide before we can plan it properly:
- Building the select drop-down itself should be straightforward (the same as the other drop-downs).
- Building the XQuery clause to do this search is not so simple, though; we should shell out to a separate function to do it, as we do with the text search.
- What we need to pull back is going to be complicated too, especially if it's combined with a text search. It's not exactly clear what the user might intend by searching for "chat" (text) and "Graveur" (annotation category). Does this mean that she's searching for all instances of "chat" that appear in an annotation which is in the Graveur category? Or does it perhaps mean all documents which have annotations in the Graveur category, which also contain "chat"?
- One approach is to say that if a category is chosen, then the search is restricted to hits within annotations in that category; and what will be retrieved, for each document, is a reduced document which includes only the
<rect>
and<div>
elements for the annotations containing hits; then the XSLT code can process only those annotations, and for each annotation, produce a thumbnail view of the image area using the web-sized version of the image, computing the view rectangle from the original image size and the annotation coordinates. - Such an approach could be usefully extended if there were two controls: one checkbox for "Search only in image annotations", which in turn enables the other, "Restrict search to this category of annotation only". If the first checkbox is checked, whatever the search, what is retrieved and displayed would be shown in a thumbnail view.
- Another option is to say that whenever a hit occurs within an annotation, the XSLT should be intelligent enough to notice that, and render the hit with a thumbnail. This is something we can implement first, and get working, before adding other controls on the page.
On balance, then, we should probably proceed by implementing the thumbnail display in XSLT first, then when that's happy, we should add the filter controls to the search page, and implement the XQuery.
Posting time spent figuring this out...