2016-09-29 83 views
0

我們想通過在分面搜索URL中傳遞額外參數並在org \ alfresco \ slingshot \ search \ search中讀取它來自定義分面搜索。 get.js ----> search.lib.js。如何通過向戶外網址傳遞額外參數來擴展分面搜索5.1.1

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

回答

0

我寫了一個blog post,涵蓋了自定義搜索頁面。儘管它不完全相同,但原理仍然相同 - 您將要創建自己的SearchService(擴展默認的SearchService),然後將其替換爲分面搜索頁面模型中的默認搜索。您需要擴展onSearchRequest函數以包含額外的請求參數。