Forum Discussion
Display Site Pages Similar to Doc Library
- Aug 17, 2022
Hello Ukiman1014
the control and setting in the highlighted content web part are limited.
For a fully customized web part view, i recommend the PnP Modern Search Web Parts. In there, you can customize the query, sort and visualization from your web parts.
Here are more information: https://microsoft-search.github.io/pnp-modern-search/
Regards, Dave
DaveMehr365 I am struggling a bit right off the bat. I have an existing "Category" column in my Site Pages. I only want PnP Search to display a list of pages with a specific category. In the https://microsoft-search.github.io/pnp-modern-search/scenarios/set-up-managed-properties/ it says that in order for anything to be filtered by the search, it must be a managed property. The column was originally just created by clicking "Add New", not going to Site Columns and clicking "Create", as stated in the instructions. So it seems that I need to create a new column as per the instructions and then go through and set that column to match the values of my original column. Is that correct?
It seems strange to me that columns created in the usual manner aren't available to search, because they're not considered Managed Properties. Am I missing something?
Hi Ukiman1014
every column, site and list, will be crawled as "Crawled Property", but only site columns will be automatically added to "Managed Properties". For your list column a Crawled Property is created, but not a Managed Property.
If necessary, you can set the managed properties so that the properties are available as a refinement, can be used in the queries, etc.
In your case
Map your list column to an existing RefinableStringXX property, after that you can use your mapped RefinableStringXX in your search. In the default RefinableStringXX properies are the settings active, to use it in search scenarios.
I prefer
1. use site columns - with a unique prefix, and withoud spaces or special characters
2. use sharepoint search admin center for search administrations (it's also possible to do it on site level, but in big environments it can become confusing)
Hope this helps.
Best, Dave
- Ukiman1014Oct 17, 2022Brass Contributor
DaveMehr365, I have this working pretty well, but I'm running into an issue that might be a limitation.
There is a repository of site pages that I need to display in the order of a date field, "Date Published", which I created and made a managed property. (I can't sort by the built-in date created or modified fields, or I would have just used the highlighted content web part.)
I can't seem to get PnP Search Results to sort by that field. I can see the field, "DatePublishedOWSDATE", in the list of fields to filter, but it doesn't display in the list of fields for sorting. I've tried to manually enter it in, including the managed property it's mapped to, "RefinableDate00", but that gives an error.
Is there some special way to get it to sort by a managed property date field? Or is sorting only limited to RefinableString fields? If so, how can I sort by a custom date field? Basically, the page is a copy of the contents of a weekly newsletter, so the "Date Published" field is when the content was originally sent out, not when the page was created.
- DaveMehr365Oct 18, 2022MVP
Hello Ukiman1014
i have created a custom date field in the page library:
And mapped to the RefinableDate00, it's not possible to create your own date managed property, you need to map it to a default:
In my result web part (PnP Serach 4.8.0 Beta 😉 ) i have configured the sort field, i have typed it manual and saved it:
Also i have added the property as column for the visualization:
It works fine with this configuration and i can sort to the custom date field.
As special way you can try to create a result source and sort by your custom field. Then use your result source in to your result web part.
Beste regards, Dave
- Ukiman1014Oct 19, 2022Brass ContributorThanks, Dave. I've done the same thing, but for some reason it's just not sorting by that property. I am not sure if maybe I created it in the wrong way or something. I am starting over to see if it helps.
I need to ask another question. What is the proper way to upgrade from version 4.7 to 4.8? I tried uploading the newer version to the SharePoint App Store but it didn't upgrade. It said that the name needed to be the same. I wasn't sure if it literally meant the file name. I didn't want to break anything, so I just deleted the beta app.
One more question, LOL. How can I get my new date property to show up in the search results? I tried modifying a few things but I couldn't figure it out. Is there a simple way to do that? This can be very frustrating.
- Ukiman1014Sep 02, 2022Brass Contributor
Thanks, Dave. I didn't understand that I had to map it to a RefinableStringXX property in order for it to work with PnP search.
Is there a way for columns that were added directly in a doc library or list to become site columns, and then managed properties? I am surprised that if a user adds a column to a list or library there's not an easy way to get that to work with PnP Search. I am assuming I'd need to go into Site Columns, create it there and then follow the steps. I'd then have to migrate the existing user-created column's data to the new managed column. Is that correct?
- DaveMehr365Sep 02, 2022MVP
Hi Ukiman1014
i don't know a process for list columns to become automatically a managed property.In practice you need a SharePoint governance. When you like documents or items from different sites or libraries in one search, you need to use the content type hub to rollout the same column on different places....or create site columns, as admin.
When nobody should be create columns, do not give permissions to others for that, only contribute, but not edit permission. With that users can manage content, but not new columns
Here are more about permission levels: https://docs.microsoft.com/en-us/sharepoint/understanding-permission-levels?source=recommendations
When you like, that users can create their own lists and columns, give them a training and define a governance, what they can do and when they need to use company terms from the tenant level term store.Good luck.
Regards, Dave
- Ukiman1014Sep 12, 2022Brass Contributor
DaveMehr365 I would like the PnP search results web part to display all items in Site Pages with a certain managed property, unless a value is entered in the PnP search box, then I'd like those results to be displayed (still filtered by the managed property). I think of it like the default search field would be a wildcard unless another value is entered. Is that possible?