cancel
Showing results for 
Search instead for 
Did you mean: 

Advanced search within a site

patrickvanhoof
Confirmed Champ
Confirmed Champ
Standard Alfresco behaviour is that via the advanced search, a search is launched over all sites to which I have access. To restrict the advanced search to search within a site (go to the advanced search from within a site) we updated the search.js file as follows:


      _buildSearchParams: function Search__buildSearchParams(searchRepository, searchAllSites, searchTerm, searchTag, searchSort, page)
      {
         var site = searchAllSites ? "" : this.options.siteId;
//         var params = YAHOO.lang.substitute("site={site}&term={term}&tag={tag}&maxResults={maxResults}&sort={sort}&query={query}&repo={repo}&rootNode={rootNode}&pageSize={pageSize}&startIndex={startIndex}",
         // remove &repo parameter
         var params = YAHOO.lang.substitute("site={site}&term={term}&tag={tag}&maxResults={maxResults}&sort={sort}&query={query}&rootNode={rootNode}&pageSize={pageSize}&startIndex={startIndex}",
         {
            site: encodeURIComponent(site),
            // repo: searchRepository.toString(),
            term: encodeURIComponent(searchTerm),
            tag: encodeURIComponent(searchTag),
            sort: encodeURIComponent(searchSort),
            query: encodeURIComponent(this.options.searchQuery),
            rootNode: encodeURIComponent(this.options.searchRootNode),
            maxResults: this.options.maxSearchResults + 1, // to calculate whether more results were available
            pageSize: this.options.pageSize,
            startIndex: (page - 1) * this.options.pageSize
         });
        
         return params;
      },

We removed the &repo parameter in
         var params = YAHOO.lang.substitute("site={site}&term={term}&tag={tag}&maxResults={maxResults}&sort={sort}&query={query}&rootNode={rootNode}&pageSize={pageSize}&startIndex={startIndex}",

and commented out
            // repo: searchRepository.toString(),

However, since version 4 this seems no longer to work as expected. When a search has over 50 results, each page in the result set displays the same 50 items…

Anybody an idea how we can correct this?

Thanks!
1 REPLY 1

patrickvanhoof
Confirmed Champ
Confirmed Champ
Solved it: replace
repo: searchRepository.toString(), 

by
repo: "",