mycore-org / mir-alias-plugin Goto Github PK
View Code? Open in Web Editor NEWmir application plugin for maintain and find URL-aliases
License: GNU General Public License v3.0
mir application plugin for maintain and find URL-aliases
License: GNU General Public License v3.0
[INFO] Compiling 1 source file to /mcr/repper/mir-alias-plugin/target/classes
[WARNING] /mcr/repper/mir-alias-plugin/src/main/java/org/mycore/alias/servlets/MCRAliasContentServlet.java:[183,46] checkPermissionForReadingDerivate(java.lang.String) in org.mycore.access.MCRAccessManager has been deprecated
Resolving alias url "/publikationen/francia/francia-recensio/2017-3/fn/cosandey_peltzer" in perspectivia.net matches alias path "47-2020", that is not part of alias here.
Seems to be related to changes from a66f7cb
We have the alias publikationen/kultgep-colloquien/3/schroeder-kadar_harfenisten/file-4
The document is found by alias, then the following search is executed:
https://perspectivia.net/servlets/solr/select?q=mods.relatedItem:repper_mods_00000836&fl=id,alias&XSL.Style=xml
It results in:
<doc>
<str name="id">pnet_mods_00003924</str>
<str name="alias">9</str>
</doc>
<doc>
<str name="id">pnet_mods_00001163</str>
<str name="alias">8</str>
</doc>
<doc>
<str name="id">pnet_mods_00000879</str>
<str name="alias">7</str>
</doc>
<doc>
<str name="id">ploneimport_mods_00010432</str>
<str name="alias">4</str>
</doc>
<doc>
<str name="id">ploneimport_mods_00010441</str>
<str name="alias">5</str>
</doc>
<doc>
<str name="id">ploneimport_mods_00010456</str>
<str name="alias">6</str>
</doc>
<doc>
<str name="id">ploneimport_mods_00010398</str>
<str name="alias">2</str>
</doc>
<doc>
<str name="id">ploneimport_mods_00010418</str>
<str name="alias">3</str>
</doc>
<doc>
<str name="id">ploneimport_mods_00010380</str>
<str name="alias">1-2014</str>
</doc>
The alias-plugin now gets a mismatch while resolving:
3/schroeder-kadar_harfenisten/file-4
I would expect that this will be resolved to new relatedItem: ploneimport_mods_00010418
schroeder-kadar_harfenisten/file-4
but instead it will be resolved to new relatedItem: ploneimport_mods_00010432
3/schroeder-kadar_harfenisten/file-
2021-07-22T10:10:58,183 INFO administrator MCRAliasContentServlet: Check if alias path context 3/schroeder-kadar_harfenisten/file-4 exists for document/derivate relations on repper_mods_00000836
2021-07-22T10:10:58,184 DEBUG administrator MCRAliasContentServlet: Process Alias Path Context: Try to shrink Alias Path Context 3/schroeder-kadar_harfenisten/file-4
2021-07-22T10:10:58,184 DEBUG administrator MCRAliasContentServlet: ---- Process Alias Path Context: 4 found in 3/schroeder-kadar_harfenisten/file-4. Shrink aliasPathContext into 3/schroeder-kadar_harfenisten/file-
2021-07-22T10:10:58,184 DEBUG administrator MCRAliasContentServlet: Process Alias Path Context: Alias Path Context 3/schroeder-kadar_harfenisten/file-4 found in Document ploneimport_mods_00010432
2021-07-22T10:10:58,185 DEBUG administrator MCRAliasContentServlet: Process Alias Path Context: New Alias Path Context is [3/schroeder-kadar_harfenisten/file-]
The code which produces the error is:
for (SolrDocument relatedDocument : relatedDocuments) {
String currentAliasOrig = (String) relatedDocument.getFieldValue(ALIAS);
if (currentAliasOrig != null) {
String currentAlias = currentAliasOrig.toLowerCase();
String possibleAliasPathContextAfter = aliasPathContext.replaceFirst(currentAlias, "");
if (nextAliasPathContextAfter.length() > possibleAliasPathContextAfter.length()) {
nextAliasPathContextAfter = possibleAliasPathContextAfter;
relatedObjectId = (String) relatedDocument.getFieldValue(OBJECT_ID);
LOGGER.debug("---- Process Alias Path Context: " + currentAlias + " found in " + aliasPathContext + ". Shrink aliasPathContext into " + nextAliasPathContextAfter);
}
}
}
This Code assumes that the longest alias is the right one but there should be a second priority if the length is the same.
/schroeder-kadar_harfenisten/file-4
vs.
3/schroeder-kadar_harfenisten/file-
The seconds priority should be the position of the alias. If the position is lower, then it should be the next alias.
Then i also like to question if this mechanism should use startsWith() and substring instead of replace, or is there a valid case where alias is cut at the end?
I still have problems with case sensitive urls, thats why I changed alias entry in solr document:
to
<xsl:value-of select="translate(text(), 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')" />
You should add LowerCaseFilterFactory
"filters": [
{
"class": "solr.LowerCaseFilterFactory"
}
]
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.