0

我们想通过在多面搜索 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"] : "";

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

1 回答 1

0

我写了一篇博客文章,其中涵盖了自定义搜索页面。尽管它不是完全相同的用例,但原理保持不变 - 您将要创建自己的 SearchService(扩展默认的),然后在分面搜索页面模型中将您的替换为默认的。您需要扩展该onSearchRequest函数以包含额外的请求参数。

于 2016-10-03T08:39:03.907 回答