Monday, February 22, 2021

Hello 2021! Amazing that it's been this long since I shared back...

Just a quick tip for today. I've been working with the PnP Modern Search v4 web parts and really like them - mainly to help tailor a search experience similar to what my customer has today with SP2010, but without me having to write code for it. I might end up tweaking things a bit (like, changing ".aspx" in the refiner to "Pages", ".docx" to "Word Document", etc) but it's giving me the functionality required. Do check them out here:

Introduction - PnP Modern Search (v4) (microsoft-search.github.io)

One of the things my customer asked for was an ability to show results from the signed in employee's location. One thought was to create a separate Search Results web part that would include the location in the search string - so if I did a search for "cafeteria menu" I'll get the menu for my work location first, vs the one that was most recently updated from the other work locations. Still working on a way to bake in my location into search relevancy, but for now, this worked. In the Query Template of the PnP Search Results web part, I'm using this:

{searchTerms} and {User.PreferredLocation}

where in my case, PreferredLocation is a User Profile property with the value for the user's preferred location. That's the syntax to use for any of the user profile properties.

Alright world, let's hope it isn't another three years til my next post! All the best!