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.
- Replace the file advsearch.js by a custom file that will include your changes.
- Find the function
onSearchClick: function ADVSearch_onSearchClick(e, obj)
- Replace the properties
site
andscope
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" });