如何通过在alfresco 5.1.1中将额外参数传递给url来扩展分面搜索

时间:2016-09-29 09:52:57

标签: alfresco-share aikau

我们希望通过在分面搜索URL中传递额外参数来自定义分面搜索,并在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

在searchDocLib json中,我们将nodeRef值分配给selectedContainer,但该参数不在search.get.js中。基本上如何在searchDocLib中传递额外的参数?如何为faceted-search.get.js启用日志,以便在share.log中打印记录器语句?

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

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" 
    } 
  ] 
} 
};

1 个答案:

答案 0 :(得分:0)

我写了blog post,其中包括自定义搜索页面。尽管用例并不完全相同,但原则仍然相同 - 您将要创建自己的SearchService(扩展默认值),然后在分面搜索页面模型中将其替换为默认值。您需要扩展onSearchRequest函数以包含额外的请求参数。