As per Alfresco documentation default search uses a Boolean "Implied AND" as like Google, Yahoo or any major search engine works. But the behavior of alfresco is seems to be using Boolean “Implied OR”.
But Customization of such kind of search is made easy by Alfresco when it comes to customize Alfresco Web Client.
Let’s go by example.
We have few resume stored as word document in our repository if we do search on Alfresco repository using keywords (java alfresco) it gives all the documents which has meta data(or Full text search) either as Java or as alfresco. But we are intended to search all those documents which have Java and alfresco both skill sets. It is the situation where alfresco default search is based on “Implied OR”.
We can configure this on Alfresco web-client customization if we are using SearchContext . We need to add the configuration in web-client-config-custom.xml as below
<alfresco-config>
<config>
<client>
<!-- set this value to true to enable AND text terms for simple/advanced search by default -->
<search-and-terms>true</search-and-terms>
  </client>
</config>
</alfresco-config>
If you are using Search Service (Search using API) then you can set SearchParameter default operator as “implied AND” as below
SearchParameters sp = new SearchParameters();
sp.addStore(Repository.getStoreRef());
sp.setLanguage(SearchService.LANGUAGE_LUCENE);
sp.setQuery(query);
sp.setDefaultOperator(SearchParameters.AND);
ResultSet nodeRefs = searchService.query(sp);
With this kind of customization we are sure that we can use exact search as like Google in our Alfresco repository.
Very helpful information, thanks Ganesh for posting it.
ReplyDeletethanks..nice post..great job
ReplyDeleteHi Ganesh,
ReplyDeleteI have configured the following file web-client-config-custom.xml and included
true
however whether I try a search as numbering AND SAT or numbering +SAT or numbering SAT, I get the same results. Is there anything else I should be looking at? thanks.
Hello,
ReplyDeleteCan you please give me what exact term you were searching for.
Regards,
Ganesh