Success Kid Search Terms Meme

Alfresco Share Search AND Drop-In Fix

Google tought us to expect search combining terms using logical AND by default. Search results for “apples and oranges” at Google match both terms. Users get confused when terms get ORed by default so that more terms yield more results. For some reason, the latter applies to the Alfresco repository Javascript search which is used by various components. There is an issue in Alfresco JIRA dating back to December 2010. Peter Löfgren tackled it in 2012. Applying his changes still requires some technical knowledge. I picked up some of his ideas and created a drop-in fix for Alfresco 4.2.c. It will most likely work with other recent 4.something versions of Alfresco as well. Be aware that this is all about defaults only. You are always free to combine explicitely “apples AND oranges” or “apples OR oranges”.

The typical user most likely encounters the confusing OR-behavior when searching in Alfresco Share. Assuming this is the most common case and due to the fact that changing all searches issued by the Javascript object may break other scripts, I chose to offer an aggressive a defensive drop-in fix – only changing the search in Share. Nevertheless, everything is in place (can be configured) to change scope. Feel free to tweak it to make every search using this object to use AND by default.

To use it, just download the file below, put it into webapps/alfresco/WEB-INF/lib and restart your appserver.

Thanks for your pioneering work, Peter !

Download Alfresco Share Search AND Drop-In Fix

References

Andreas Steffan
Pragmatic ? Scientist and DevOps Mind @ Contentreich. Believes in Open Source, the Open Web and Linux. Freelancing in DevOps-, Cloud-, Kubernetes, JVM- and Contentland and speaks Clojure, Kotlin, Groovy, Go, Python, JavaScript, Java, Alfresco and WordPress. Built infrastructure before it was cool. ❤️ Emacs.

5 thoughts on “Alfresco Share Search AND Drop-In Fix”

  1. Thanks for the mention and acknowledgement.
    Since I started to use this I have noticed that the ALL keyword in default-query-template does not include all you want to search. ALL probably includes all properties, but does not include tags. So I now use
    %(ALL TAG) in the default-query-template.
    I was warned that ALL expands to a very large lucene/solr query and might have a performance impact but I haven’t noticed any so far.

  2. Thanks Alberto.

    Just in case: I think the extension might not work with 4.2.e as it did in 4.2.d due to changes in Alfresco repo Javascript which is used under the covers. I will have a look an add an updated extension for 4.2.e if that’s the case.

  3. I think it works fine in Alfresco Community 4.2.e. I have done a lot of searchs with this version and the results are ok.

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert