Decode document name in corpus path - #912
Open
TimmLehmberg wants to merge 1 commit into
Open
TimmLehmberg wants to merge 1 commit into
TimmLehmberg wants to merge 1 commit into
Conversation
The corpus path shown above a match is built from the raw, percent encoded node ID (see ResultFetchJob#createSaltFromMatch). Helper#getCorpusPath decoded the corpus names while traversing the corpus graph, but added the document name unchanged. Document names containing an umlaut were therefore displayed as "L%C3%BCb._HistB._L" instead of "Lüb._HistB._L". Decoding is now done in a single place and applied to the document name as well. The raw variant (decodeElements = false) is unchanged, because the undecoded names are used as identifiers elsewhere. Refs korpling#837
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Document names containing an umlaut are displayed percent encoded in the match
list, e.g.
L%C3%BCb._HistB._Linstead ofLüb._HistB._L. This is issue #837,originally reported for the ReN corpus, where the philological sigla used as
document names regularly contain umlauts.
Cause
ResultFetchJob#createSaltFromMatchbuilds the corpus graph of a match from theraw, percent encoded node ID, which is intentional because the ID has to stay
valid.
Helper#getCorpusPath(SCorpusGraph, SDocument, boolean)then decodes thecorpus names while traversing the corpus graph, but adds
doc.getName()unchanged. The URI based variant
Helper#getCorpusPath(String, boolean)decodesevery element of the path, so the two variants behaved differently.
This also explains why the path is displayed correctly when searching for the
document itself (
annis:doc="Lüb._Brant_NarrenS_1497"), which was fixed in4.9.8. Token matches still go through the corpus graph variant.
Fix
The decoding is moved into a single private method which is applied to the
document name as well. The behaviour for
decodeElements = falseis unchanged,because the raw names are used as identifiers elsewhere.
Test
HelperTest#testGetCorpusPathFromSpecialCharacterDocumentbuilds a corpus graphthe same way
ResultFetchJobdoes and checks both the decoded and the raw path.It fails before the change:
I am not familiar with every place the corpus path is used, so if there is a
reason to keep the raw document name here, I am happy to adapt the patch.
Refs #837