Giter VIP home page Giter VIP logo

mir-alias-plugin's People

Contributors

fluetze avatar rochpaul avatar sebhofmann avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

sebhofmann

mir-alias-plugin's Issues

error in alias resolving

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

alias relatedItem match priority is incomplete

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?

Fix deprecation warning

[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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.