Enable search for texts based on line-level ALTO annotations #47
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The current ALTO-based text indexing assumes that transcriptions are recorded at a word-level, e.g.:
Depending on the OCR/HTR tool, this is not always the case, and transcriptions may instead be recorded at a line-level, e.g.:
In the letter case, the search only populates the "hits" portion of the response, while "resources" (annotations) are left blank. Due to this, search result highlighting does not work in Mirador/UV.
This PR introduces a quick work-around to enable search result highlighting for line-level annotations. Text lines are tokenised to create new
TextWords, which retain the original line's coordinates and dimensions, allowing the rest of the search to function properly.Additionally, this PR sets the
textGranularityfor annotation pages tolineif more than one work is present in aTextWordcontent. This is more of a cosmetic than functionally-required change.