I’ve been working on search, mostly search center, lately. I need to create a custom search navigation to display only content from a legacy SharePoint site. So, I thought I’d share my process here.

First, the content needs to be indexed by the local search service. In other words, SharePoint 2013 must index legacy SharePoint site(s). Second, you’ll need to have access to modify the search center. Since I created my Search Center in its own site collection, the steps outlined below reflect that.

1. Launch the Search Center site from the browser window
2. Select Site Settings
3. Under Site Collection Administration, select Search Result Sources
4. Select New Result Source
5. Provide a name for the new result source (ex: Legacy)
6. Under the Protocol section, select Local SharePoint
7. Under the Type section, select SharePoint Search Results
8. Under the Query Transform section, click Launch Query Builder
9. In the Query text box, type: {searchTerms} (contentclass:sts_listitem) path:http://<oldSharePointsite>
Your screen should look similar to the following screenshot:

LegacyQueryBuilder

10. To validate the query, click Test Query (This should return relevant results in the preview pane.)
11. Select the TEST tab, and select Show more
12. To mimic what a user will see in the Search Center, type a query in the {searchTerms}: box
13. Click Test query (This should return a filtered result view based on the value provided in the searchTerms box.
14. Click OK to close the Build Query window
15. Click Save to close the Result Source window
16. Select Add a page from the Gear Icon
17. Provide a name for the page (ex: Legacy), then click Create
18. In the Search Results web part, select Edit Web Part

19. In the Web part properties, click Change query

20. In the Select a query section, select Legacy (Site Collection) from the dropdown menu

LegacySiteCollection

21. Click OK to close the Build Your Query window
22. Click OK to close the Web part properties window
23. Check in and publish the page
24. From Search Center, select Site Settings
25. Under Search, select Search Settings
26. Under Configure Search Navigation section, select Add Link
27. Provide a title (ex: Legacy) (This will appear on the Search Navigation as “Legacy”)
28. Select Browse
29. Select Pages, select Legacy.aspx, then click Insert

30. Click OK to close the Navigation Link window
31. Click OK to close the Search Settings window
32. To validate changes made to the Custom Search Navigation, navigate to the Search Center site
33. Type in a query string – notice the results displayed at the bottom of the ‘Everything’ tab.
34. Click on the ‘Legacy’ tab, notice the results is less than the results in the ‘Everything’ tab

Your custom navigation should look similar to this:

CustomSearchNavigation

Happy searching!!

Advertisements