Tips & Tricks for customizing PnP Modern Search

Поділитися
Вставка

КОМЕНТАРІ • 11

  • @krzysiekrog5103
    @krzysiekrog5103 10 місяців тому

    Thank you for this! Very helpful!

    • @sympraxisc
      @sympraxisc  10 місяців тому

      So happy we could help! If you have ideas for other topics we should cover please let us know.

  • @RyanHoward-l7v
    @RyanHoward-l7v 10 місяців тому +2

    Looking to add slots that grab the Mobile Number and Department for individuals into the details list.

    • @juliemturner
      @juliemturner 10 місяців тому +1

      Are you using SharePoint search or Microsoft search for your configuration? Assuming you're using SharePoint Search then it's a matter of looking up what fields provide that information in the Search configuration. By default, 'Department' is mapped to 'People:Department' crawled property and 'MobilePhone' managed property is mapped to 'People:CellPhone'. You might start there.

  • @Nick-sz1ez
    @Nick-sz1ez 8 місяців тому

    Im hoping someone can expand on the sorting by Title steps. It sounds like creating a Calculated column on the Content Type and simply setting it to [Title]. This would then need to have a Refinable string created and mapped with this? Is there not an easier way to just create a Refinable string and map it directly to ows_Title or something similar? Any additional details or resources would be greatly appreciated - great video otherwise!

    • @Nick-sz1ez
      @Nick-sz1ez 8 місяців тому

      In addition to this issue, I tried using the Calculate field but if Title is blank then the value is set to 0. PNP search sees all empty Titles elements as "float;#0" and items with a title as "string;#TitleGoesHere". Therefore i cant sort the items correctly. Is there a trick to remove the labeling of these so the data is clean?

    • @sympraxisc
      @sympraxisc  8 місяців тому +1

      @Nick-sz1ez you have two options here
      Option 1: Copy Title Managed Property (My new preferred approach)
      For this option you would create a new managed property from a RefinableString can map it to all the same properties that are mapped to the out of the box Title managed property. Our friend Kasper Larsen has created a blog post about this. www.m365thinking.com/post/fix-one-of-the-problems-in-sharepoint-search-make-title-sortable
      Option 2: Create a Calculated Column
      Create a calculated field that replicates the Title field in the content type gallery. Add this site column to all the content types you would like to be able to sort by. This works great if you have a robust enterprise information architecture and have a based content type for your organized e.g. MyCompanyDocument where you can push this added column down to all content types. The drawback to this as you noted is that the data is stored as string;#MyTitle. I had not run into the float;# if title is blank. As a general rule Title should not be blank as M365 uses it for more than just the search managed property but that is another issue.
      PnP Search WebPart
      With either option I recommend using the sortable refinable string for sorting only and using the Title field in the PnP search for display in the web part. That way you don't need to worry about any extra characters. If you did use the calculated column you could use a HandleBars helper function to do a replace on the string;# with empty string giving you the rest of the string.
      Hope that helps

    • @Nick-sz1ez
      @Nick-sz1ez 8 місяців тому +1

      @@sympraxisc The hardest part of option 1 is actually finding the properties! Searching for Basic or Office has zero results. Instead, searching for "#10" or "#2" was how i found them. I think Microsoft could improve their search functionality inside their search settings. Thank you for the info provided - much appreciated.

    • @juliemturner
      @juliemturner 8 місяців тому

      @@Nick-sz1ez Yes, I had the same issue, Kasper should add a note to his post.

    • @KasperBoLarsen
      @KasperBoLarsen 4 місяці тому

      ​@@juliemturner I am working on a PnP.PowerShell script that will map the required crawled props to a RefinableString of your choice. Will that do?