Skip to content

Instantly share code, notes, and snippets.

@beckettkev
Created December 17, 2015 12:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save beckettkev/23e2659f0082f85adcb0 to your computer and use it in GitHub Desktop.
Save beckettkev/23e2659f0082f85adcb0 to your computer and use it in GitHub Desktop.
( function ( workspace, $ ) {
//we keep track of previous refinement item matches in this array
var matches = [];
//this is where we keep track of our refinement items for the Workspace refiner
var workspaceItems;
workspace.Mapping = {
//straight site collection one to one mapping on SPSiteURL. This is detailed in the first part of the scenario.
Simple: {
'Mappings': [
{ 'Label': 'News', 'Relative': '/sites/news' },
{ 'Label': 'Help', 'Relative': '/sites/help' },
{ 'Label': 'Search', 'Relative': '/sites/search' },
{ 'Label': 'Location', 'Relative': '/sites/location' }
],
'RegExpValues' : [
/^\/sites\/news/,
/^\/sites\/help/,
/^\/sites\/search/,
/^\/sites\/location/
]
},
//Used for sounds like matches (e.g. /sites/essentials, /sites/essentials-hr etc..)
Standard: {
'Mappings': [
{ 'Label': 'Essentials', 'Relative': '/sites/essentials' },
{ 'Label': 'Projects', 'Relative': '/sites/project' },
{ 'Label': 'Bids', 'Relative': '/sites/bid' }
],
'RegExpValues': [
/^\/sites\/essentials/,
/^\/sites\/project/,
/^\/sites\/bid/
]
},
//used for multiple differing URL mappings for the communities IA (e.g /sites/communities, /sites/community, /sites/water, /sites/rail-engineering etc..)
Community: {
'Mappings': [
{
'Label': 'Communities', 'Relative': '/sites/communities',
'Label': 'Communities', 'Relative': '/sites/communityengagement',
'Label': 'Communities', 'Relative': '/sites/engineeringpractice',
'Label': 'Communities', 'Relative': '/sites/itdecisions',
'Label': 'Communities', 'Relative': '/sites/communicatingsuccess'
}
],
'RegExpValues' : [
/^\/sites\/communities/,
/^\/sites\/engineeringpractice/,
/^\/sites\/itdecisions/,
/^\/sites\/communicatingsuccess/
]
},
...
})( MyCompany.MyProject.Search.Workspace = MyCompany.MyProject.Search.Workspace || {}, jQuery );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment