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
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.
Thanks for pointing out the TAG placeholder. I have updated the jar.
Regarding performance, I did not notice a serious penalty either.
One of the best add ons for alfresco share!
Thanks!!
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.
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.