alfresco-shareaikau

customize simple search alfresco community 5


Alfresco simple search field searches on document content and folders as default.

Because I'm thinking of using a tag taxonomy I would like to default the simple search field to only search on tags without using the "TAG:" prefix and exclude content and folders. Content and folders can stay as a search option in Advanced search.

The default query looks like this:

  cm:name cm:title cm:description my:authorisedBy 
  ia:whatEvent ia:descriptionEvent lnk:title 
  lnk:description TEXT  TAG

Can anyone give me an idea how this query can be modified only to search on tags?


Solution

  • I'm going to assume that by "simple search" you're referring to the search box in the header bar displayed in Share. This is rendered by the Aikau widget alfresco/header/SearchBox and provides a number of options for customizations.

    I think that your best option is going to be to extend the default widget with your own version and override the generateSearchTerm function. This will allow you to take the term provided (e.g. whatever the user has entered into the search box) and manipulate it with the additional advanced search text before it is used in calls to the search REST APIs.

    This old blog post provides and example of extending a widget, however you should use the approach outlined in this blog post to add your custom package (rather than editing surf.xml directly)