How to set the Advance Search scope to the same site always in Alfresco Share

To set the the scope to the same site every time we perform a search from the Advance Search form, we’ll need to redirect the Share application to the search result page, setting the site ID on the URL and the scope through JavaScript. That will make Share to search within the same site always.

  1. Replace the file advsearch.js by a custom file that will include your changes.
  2. Find the function onSearchClick: function ADVSearch_onSearchClick(e, obj)
  3. Replace the properties site and scope to include your site ID.
         var url = YAHOO.lang.substitute(Alfresco.constants.URL_PAGECONTEXT + this.options.searchPath,
         {
            site: "site/your-site-id/",
            terms: encodeURIComponent(Dom.get(this.id + "-search-text").value),
            query: encodeURIComponent(YAHOO.lang.JSON.stringify(formData)),
            scope: "your-site-id"
         });