0

We want to customize the faceted search by passing extra argument in the faceted search URL and read it in org\alfresco\slingshot\search\search.get.js---->search.lib.js.

http://localhost:8080/share/page/dp/ws/faceted-search#searchTerm=Koala.jpg&scope=repo&nodeRef=test

In searchDocLib json ,we have nodeRef value assigned it to selectedContainer but that argument is not coming in search.get.js. Basically how to pass extra argument in searchDocLib?How to enable logs for faceted-search.get.js so that logger statements should be printed in share.log?

var noderef = (page.url.args["nodeRef"] != null) ? page.url.args["nodeRef"] : "";

logger.log(page.url.templateArgs.nodeRef+"....nodeRef = "+nodeRef);

// Build the searchDocLib model 
var searchDocLib = { 
id: "FCTSRCH_SEARCH_RESULTS_LIST", 
name: "alfresco/documentlibrary/AlfSearchList", 
config: { 
  viewPreferenceProperty: "org.alfresco.share.searchList.viewRendererName", 
  view: viewRendererName, 
  waitForPageWidgets: true, 
  useHash: true, 
  useLocalStorageHashFallback: true, 
  hashVarsForUpdate: [ 
    "searchTerm", 
    "facetFilters", 
    "sortField", 
    "sortAscending", 
    "query", 
    "scope", 
    "selectedContainer" 
  ], 
  selectedScope: "repo", 
  useInfiniteScroll: true, 
  siteId: null, 
  rootNode: repoRootNode, 
  repo: false, 
  selectedContainer: noderef, 
  additionalControlsTarget: "FCTSRCH_RESULTS_MENU_BAR", 
  additionalViewControlVisibilityConfig: hideOnZeroResultsConfig, 
  widgets: [ 
  { 
    id: "FCTSRCH_SEARCH_ADVICE_NO_RESULTS", 
    name: "alfresco/documentlibrary/views/AlfSearchListView", 
    config: { 
      widgetsForNoDataDisplay: widgetsForNoDataDisplay, 
      a11yCaption: msg.get("faceted-search.results.caption"), 
      a11yCaptionClass: "hiddenAccessible", 
      widgetsForHeader: [ 
        { 
          id: "FCTSRCH_THUMBNAIL_HEADER_CELL", 
          name: "alfresco/documentlibrary/views/layouts/HeaderCell", 
          config: { 
            label: msg.get("faceted-search.results.heading.thumbnail"), 
            class: "hiddenAccessible", 
            a11yScope: "col" 
          } 
        }, 
        { 
          id: "FCTSRCH_DETAILS_HEADER_CELL", 
          name: "alfresco/documentlibrary/views/layouts/HeaderCell", 
          config: { 
            label: msg.get("faceted-search.results.heading.details"), 
            class: "hiddenAccessible", 
            a11yScope: "col" 
          } 
        }, 
        {
          id: "FCTSRCH_ACTIONS_HEADER_CELL", 
          name: "alfresco/documentlibrary/views/layouts/HeaderCell", 
          config: { 
            label: msg.get("faceted-search.results.heading.actions"), 
            class: "hiddenAccessible", 
            a11yScope: "col" 
          } 
        } 
      ], 
      widgets: [ 
        { 
          id: "FCTSRCH_SEARCH_RESULT", 
          name: "alfresco/search/AlfSearchResult", 
          config: { 
            enableContextMenu: false 
          } 
        } 
      ] 
    } 
    }, 
    { 
      id: "FCTSRCH_GALLERY_VIEW", 
      name: "alfresco/documentlibrary/views/AlfGalleryView", 
      config: { 
        showNextLink: true, 
        nextLinkLabel: msg.get("faceted-search.show-more-results.label"), 
        widgetsForNoDataDisplay: widgetsForNoDataDisplay, 
        widgets: [ 
          { 
            id: "FCTSRCH_GALLERY_VIEW_THUMBNAIL_DOC_OR_FOLDER", 
            name: "alfresco/search/SearchGalleryThumbnail", 
            config: { 
              widgetsForSelectBar: [ 
                { 
                  id: "FCTSRCH_GALLERY_VIEW_MORE_INFO_OR_FOLDER", 
                  name: "alfresco/renderers/MoreInfo", 
                  align: "right", 
                  config: { 
                    filterActions: true, 
                    xhrRequired: true
                  } 
                } 
              ], 
              publishTopic: "ALF_NAVIGATE_TO_PAGE", 
              renderFilter: [ 
                { 
                  property: "type", 
                  values: ["document","folder"], 
                  negate: false 
                } 
              ] 
            } 
          }, 
          { 
            id: "FCTSRCH_GALLERY_VIEW_THUMBNAIL_OTHER", 
            name: "alfresco/search/SearchGalleryThumbnail", 
            config: { 
              widgetsForSelectBar: [ 
                { 
                  id: "FCTSRCH_GALLERY_VIEW_MORE_INFO_OTHER", 
                  name: "alfresco/renderers/MoreInfo", 
                  align: "right", 
                  config: { 
                    filterActions: true, 
                    allowedActionsString: "[\"document-delete\"]", 
                    xhrRequired: true 
                  } 
                } 
              ], 
              publishTopic: "ALF_NAVIGATE_TO_PAGE", 
              renderFilter: [ 
                { 
                  property: "type", 
                  values: ["document","folder"], 
                  negate: true 
                } 
              ] 
            } 
          } 
        ] 
      } 
    }, 
    { 
      id: "FCTSRCH_INFINITE_SCROLL", 
      name: "alfresco/documentlibrary/AlfDocumentListInfiniteScroll" 
    } 
  ] 
} 
};
Dave Draper
  • 1,837
  • 11
  • 25
user739115
  • 1,117
  • 5
  • 20
  • 41

1 Answers1

0

I've written a blog post that covers customizing the search page. Although it isn't exactly the same use case, the principle remains the same - you're going to want to create your own SearchService (extending the default one) and then swap yours for the default one in the faceted-search page model. You'll want to extend the onSearchRequest function to include the extra request parameter.

Dave Draper
  • 1,837
  • 11
  • 25