0

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?

Dave Draper
  • 1,837
  • 11
  • 25
pw skiold
  • 3
  • 2

1 Answers1

0

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)

Dave Draper
  • 1,837
  • 11
  • 25
  • I thought the term entered by user was handled by this file: ./tomcat/shared/classes/alfresco//share-config-custom.xml I just can't find how to modify it to only search tags. Btw. thanks for your reply ;-) – pw skiold Sep 09 '16 at 06:26
  • No, the configuration defined in the share-config.xml file is not related to that at all... you won't be able to alter that configuration to only search for tags. – Dave Draper Sep 09 '16 at 10:24
  • @DaveDraper could you share the path for alresco/header/SearchBox ? – nikhil84 Jan 19 '17 at 12:06
  • @DaveDraper Link is broken. – Sanjay Apr 13 '21 at 04:18