using metadata to refine sharepoint searches scott hickman – it4e [email protected] april 15,...
TRANSCRIPT
USING METADATATO REFINE SHAREPOINT SEARCHESS C O T T H I C K M A N – I T 4 EC S H I C K M A N @ I T 4 E . C O MA P R I L 1 5 , 2 0 1 5
Scott Hickman – [email protected] 15, 2015
OUTLINE
Creating metadata tags in the Term Management StoreAdding metadata to a refinement panelEnabling metadata-driven search refinement
VERSIONS
SP 2010 SP Server 2010
SP 2013 SP Server 2013
Refinement Panel
Yes Yes Yes Yes
Metadata-driven navigation
No No Yes Yes
DEFINITIONS:
Metadata: Data about data. This is often seen in the form of column values in a SharePoint library or list, but can take many other forms.Managed Term: A word or a phrase that can be associated with a SharePoint item. Managed terms are usually predefined.Term Set: A collection of related terms. For example, the term set named “colors” could contain “red”, “blue”, “yellow”, etc.Term Store Management: Managed Metadata Service where a SharePoint user can create and modify metadata terms
CREATING METADATA
Two ways of navigating to the term store:
1. Central Administration->Manage service application (under Application Management)->Managed Metadata Service (the top one)
2. Central Administration->Site Settings->Term store management (under Site Administration)
CREATING NEW TERMS AND TERM SETS1. Hover over “Managed Metadata Service”, click the small arrow
that appears, and click “New Group”. Name it.
2. Hover over the group/folder, click the small arrow that appears, and click “New Term Set”. Name it.
3. Hover over the term set, click the small arrow that appears, and click “New Term”. Name it. (Note: Press the enter/return key to create another term).
4. (Optional) You can also create sub-terms within terms.
HOW TO SET UP TERM SET FOR REFINEMENT PANEL -Each term set corresponds to one term set on the refinement panel:
=
HOW TO SET UP TERM SETS FOR NAVIGATION -Each term in a term set corresponds to one dropdown menu on the metadata-driven navigation bar. Each sub-term is a menu item.
=
CREATE A SITE COLUMN
1. Portal Site>Site Settings>Site columns (under Web Designer Galleries)
2. Click “Create”
3. Name the column
4. Click “Managed Metadata” for the column type
5. Under “Term Set Settings”, find the term set you want to add to the Refinement Panel
6. You can modify the rest of the options to your liking
RUNNING A FULL CRAWL
1. Central Administration>Manage service applications (under Application Management)>Search Service Application>Content Sources (under Crawling)
2. Hover over “Local SharePoint sites”, click the arrow, and click “Start Full Crawl”
3. Wait for the crawl to finish. You can click the “Refresh” button to check the status of the crawl
CREATING A MANAGED PROPERTY1. Central Administration>Manage service applications>Search
Service Application>Search Schema (under Queries and Results)
2. Click “New Managed property”
MANAGED PROPERTY SETTINGS Type: TextQueryable: YesRetrievable: YesAllow multiple values: YesRefinable: Yes – activeSortable: Yes – activeSafe: YesToken Normalization: Yes
Under “Mappings to crawled properties”, click “Add a mapping”
Find the property based on the column you created. It will look like “ows_columnname”, with spaces in the name replaced by “x0020”. Highlight it and click OK
Once the Managed Property is created, run another full crawl
If you can’t find the crawled property, see the next slide…
IF YOU CAN’T FIND THE CRAWLED PROPERTY… Add the column to a document library and tag a few documents with metadata from the column’s Managed Metadata service. THEN re-run the full crawl. The crawled property should now be picked up.
EDITING THE SEARCH PAGE
On the Search page, run a search to get to the results.aspx page
Click the gear in the top-right corner, then “Edit Page”
EDITING THE REFINEMENT PANEL1. Hover on the Refinement Panel web-part and click the down arrow,
then “Edit Web Part”
2. On the Web Part Properties window, click the “Choose Refiners…” button.
3. Find your managed property in the “Available refiners” panel. Click it, then click the “Add >” button to add it to the Selected refiners (this means it is on the refinement panel”
4. Adjust the order of the refiners with the “Move up/down” buttons.
5. Enter in a “Display name” if you wish.
6. Click “OK”.
7. Click “OK” in the web part properties, then publish the page.
SETTING UP THE TERM SET FOR NAVIGATION1. Central Administration>Site Settings>Term store management
2. Click the term set you wish to use for navigation
3. Click the “Intended Use” tab.
4. Make sure the “Use this Term Set for Site Navigation” checkbox is checked.
5. Click the “Save” button.
6. Click the “Term-Driven Pages” tab.
7. Enter in the RELATIVE URL into the “Target Page Settings” box to your search results (results.aspx) page.
8. Click the “Save” button.
ENABLING MANAGED NAVIGATION1. Search Center>Site Settings>Navigation (under Look and Feel)
2. Set both Global Navigation and Current Navigation to “Managed Navigation”
3. Under “Managed Navigation: Term Set”, choose the term set you want to use.
4. Make sure “Add new pages to navigation automatically” is checked.
5. Click “OK”.
Managed navigation should now work, but it won’t appear on the results.aspx page yet.
ENABLING MANAGED NAVIGATION ON THE RESULTS PAGE1. On the Search page, run a search to get to the results.aspx page
2. Click the gear in the top-right corner, then “Edit Page”
3. In the “Main Zone”, click “Add a Web Part”
4. Under “Categories”, click “Media and Content”, then “Script Editor”, and “Add”.
5. In the “Script Editor” web part, click “EDIT SNIPPET”.
6. Enter in the javascript code found on the next slide.
7. Click “Insert”.
CODE FOR SCRIPT EDITOR WEB PART
<script language="javascript">var refElm = document.getElementsByClassName('ms-searchCenter-refinement');if (refElm.length > 0) {// Unhide the title rowdocument.getElementById('s4-titlerow').setAttribute('style', 'display:block !important');// Set the Site Titledocument.getElementById('DeltaPlaceHolderPageTitleInTitleArea').innerHTML = 'Search Center';// Hide the search icondocument.getElementById('searchIcon').style.display = 'none';// Remove the top margin refElm[0].style.marginTop = 0;// The following lines are only needed for firefoxvar css = '#s4-bodyContainer #s4-titlerow { display: block !important; }',head = document.getElementsByTagName('head')[0],style = document.createElement('style');style.type = 'text/css';style.appendChild(document.createTextNode(css));head.appendChild(style);}</script>
FIXING THE SEARCH RESULTS1. While still editing the results.aspx page, hover over the “Search
Results” web part and edit it.
2. In the web part properties panel, click the “Change query” button.
3. Under “BASICS”, click the “Switch to Advanced Mode”
4. In the “Query text”, replace it with the string in he next slide.
5. Click the “OK” button.”
6. In the web part properties panel, click the “OK” button.
7. Publish the page.
Everything should now work!
QUERY TEXT FOR SEARCH RESULTS WEB PART
(FileExtension:doc OR FileExtension:docx OR FileExtension:xls OR FileExtension:xlsx OR FileExtension:ppt OR FileExtension:pptx OR FileExtension:pdf OR FileExtension:txt) (IsDocument:"True" OR contentclass:"STS_ListItem") owstaxidmetadataalltagsinfo:{Term.Id} {SearchBoxQuery}