locked
Help with refinement panel and search result web part RRS feed

  • Question

  • Can I do the following things in the refinement panel (ootb)

    1) display custom content types (like MyImage, MyDocument,MyProposal, etc)
    2) make these content types static in the refinement panel so that they show all the time even if there are no results in the search core result web part?

    Now about search core result web part:

    1) can I display results in the search core web part based on the content types specified in the refinement panel when the user visits that page? The search should not be done via search box. Content types are used to query the data and display them in the search results web part

    Thursday, November 22, 2012 9:20 AM

Answers

  • Bummer: I answered this by testing in SharePoint 2013. The below does not apply directly to SP 2010, but I hope it is useful anyway. The principles are the same but details may vary.

    Hi Helm,

    Refinement panel:

    There is a pretty new article on how to configure the refinement web part available now.

    To your questions:

    1) Out of the box the refinement panel shows "Result Type" which contains pre-defined values such as Web Page, SharePoint Site, Team Site etc. If your content type is e.g. inheriting from the "Item" content type it will show up as "Web Page". I will do some more digging about showing the actual content type and come back with info if I find something useful.

    2) The refinement panel by design only shows the refinement values that are actually found in the result set. When a user clicks on them she "drills down" to see only results with that particular value. Returning 0 results then would probably give a weird user experience.

    Search results web part:

    There is also an article about how to configure the search results web part.

    You probably want to look into how to create result sources, as described in this blog posting.

    When a user clicks on something in the refinement panel, that refinement triggers a drill-down search and the results from that search are shown. Visually, this is indicated by having the value clicked on (e.g. "Web page") shown in a different color. So, for anything which is properly shown in the refinement panel you get exactly the effect you want.

    Hope this was somewhat useful,

    -Helge


    Helge Solheim


    Friday, November 23, 2012 11:26 AM
  • Bummer: I answered this by testing in SharePoint 2013. The below does not apply directly to SP 2010, but I hope it is useful anyway.

    Hi again,

    Good news. To test this I created a custom site content type called HelgesListContentType, inheriting from Item and created an instance of that in a list. Further, there is a managed property called ContentType which does pretty much what you want. I added it to my list of refiners (as described here), and voila:

    Here you will see the OOTB Result type at the top with the generic values, and the Content Type at the bottom with the custom content types you wanted.

    To figure out which managed property had the value needed, I used this powershell:

    $url = "http://localhost"
    $site = new-Object Microsoft.SharePoint.SPSite $url
    $kq = new-Object Microsoft.Office.Server.Search.Query.KeywordQuery $site
    
    $enumResultType = [Microsoft.Office.Server.Search.Query.ResultType]
    
    $kq.QueryText = 'test'
    $kq.StartRow = 0
    $kq.RowLimit = 10
    
    $kq.SelectProperties.Add('contenttype')
    $kq.SelectProperties.Add('contenttypeid')
    
    $executor = new-Object Microsoft.Office.Server.Search.Query.SearchExecutor
    $resultTableCollection = $executor.ExecuteQuery($kq)
    
    $relResults = $resultTableCollection[$enumResultType::RelevantResults]
    $relResults.Table.Rows
    By looking at the results I could see that ContentType contains the needed info, and luckily it is refinable OOTB.

    Hope this helps,

    -Helge


    Helge Solheim


    Friday, November 23, 2012 11:48 AM

All replies

  • Bummer: I answered this by testing in SharePoint 2013. The below does not apply directly to SP 2010, but I hope it is useful anyway. The principles are the same but details may vary.

    Hi Helm,

    Refinement panel:

    There is a pretty new article on how to configure the refinement web part available now.

    To your questions:

    1) Out of the box the refinement panel shows "Result Type" which contains pre-defined values such as Web Page, SharePoint Site, Team Site etc. If your content type is e.g. inheriting from the "Item" content type it will show up as "Web Page". I will do some more digging about showing the actual content type and come back with info if I find something useful.

    2) The refinement panel by design only shows the refinement values that are actually found in the result set. When a user clicks on them she "drills down" to see only results with that particular value. Returning 0 results then would probably give a weird user experience.

    Search results web part:

    There is also an article about how to configure the search results web part.

    You probably want to look into how to create result sources, as described in this blog posting.

    When a user clicks on something in the refinement panel, that refinement triggers a drill-down search and the results from that search are shown. Visually, this is indicated by having the value clicked on (e.g. "Web page") shown in a different color. So, for anything which is properly shown in the refinement panel you get exactly the effect you want.

    Hope this was somewhat useful,

    -Helge


    Helge Solheim


    Friday, November 23, 2012 11:26 AM
  • Bummer: I answered this by testing in SharePoint 2013. The below does not apply directly to SP 2010, but I hope it is useful anyway.

    Hi again,

    Good news. To test this I created a custom site content type called HelgesListContentType, inheriting from Item and created an instance of that in a list. Further, there is a managed property called ContentType which does pretty much what you want. I added it to my list of refiners (as described here), and voila:

    Here you will see the OOTB Result type at the top with the generic values, and the Content Type at the bottom with the custom content types you wanted.

    To figure out which managed property had the value needed, I used this powershell:

    $url = "http://localhost"
    $site = new-Object Microsoft.SharePoint.SPSite $url
    $kq = new-Object Microsoft.Office.Server.Search.Query.KeywordQuery $site
    
    $enumResultType = [Microsoft.Office.Server.Search.Query.ResultType]
    
    $kq.QueryText = 'test'
    $kq.StartRow = 0
    $kq.RowLimit = 10
    
    $kq.SelectProperties.Add('contenttype')
    $kq.SelectProperties.Add('contenttypeid')
    
    $executor = new-Object Microsoft.Office.Server.Search.Query.SearchExecutor
    $resultTableCollection = $executor.ExecuteQuery($kq)
    
    $relResults = $resultTableCollection[$enumResultType::RelevantResults]
    $relResults.Table.Rows
    By looking at the results I could see that ContentType contains the needed info, and luckily it is refinable OOTB.

    Hope this helps,

    -Helge


    Helge Solheim


    Friday, November 23, 2012 11:48 AM
  • Hi Helge,
    I am trying to find the list of Result types in the refinement ootb. some of them displayed in my search pages are: 
    Excel, PDF, Web Page, Word. 

    I did not find the actual names displayed on the search page in the Filter_Default.html file. 

    how can i find all the names of the Result Types that will come in the ootb refinement panel other than Excel, PDF, Web Page, Word, Team Site, Sharepoint site..
    Monday, March 25, 2013 10:50 AM
  • Hi Veeresh,

    The actual names displayed are not in the Filter_Default.html file. However, that file refers to a resx file (resource file) so you can find the resource strings and their actual value in IIS. (This redirection is due to localization of those strings to different languages, depending on your installation language setting.)

    Hope this helps,

    -Helge


    Helge Solheim

    Wednesday, April 3, 2013 11:44 AM
  • Helm,

    Take a look at http://www.glynblogs.com/2011/01/create-a-content-type-search-refinement-panel-in-sharepoint-2010.html which is a focussed look at Content type refinement in SharePoint 2010. Note Glyn's point about the problem with the managed property not working properly.. You'll need to map your own.

    Paul


    Please ensure that you mark a question as Answered once you receive a satisfactory response. This helps people in future when searching and helps prevent the same questions being asked multiple times.

    Thursday, April 4, 2013 2:34 PM