Closed h-h-o closed 2 years ago
Hi @h-h-o, the Title managed property is not sortable by default in the schema so you can't use it:
You can update a RefinableStringXXX with the same crawled properties to achieve what you want.
Thank you @FranckyC
I don't know how I've missed that as I checked the managed property. But you solution is spot on, and I've got it working with a RefinableString.
One remark though. A RefinableString is always configured with "Include content from all crawled properties" and this cannot be changed. So rather than including all crawled properties from Title, you have to add only the ones needed for the content types in the search results to avoid duplicates.
@h-h-o @wobba "you have to add only the ones needed for the content types in the search results to avoid duplicates" How do you know what crawled properties that really are needed? Is there any way to get the value of a crawled property for a specific document?
@schoier no, but you can use the Search Query Tool to see which crawled properties are emitted for a result. To see the value you need to map it to a managed property.
We had trouble finding the crawled property for the Title column in a standard SharePoint Online list. Much of the online documentation pointed to ows_Title or other crawled properties. We ended up identifying ows_LinkTitle as a crawled property that stored the "Title" text we were looking to sort by. So we added ows_LinkTitle crawled property to the refinablestring01 managed property. Then we used the refinablestring01 as the field to sort by in the PnP search results web part sort config.
Thank you @wobba for the tip on using the SharePoint Search Query Tool.
@SJNBham see https://github.com/microsoft-search/pnp-modern-search/issues/2492 as you can use "Office:2" as well for title.
working on this issue with Microsoft for over 6 months now, its annoying they don't seem to know or involve right people to fix a basic search issue. On my SPO site I'm using PnP search webparts, refiners, and vertical components on a page to display results from several libraries in same site. I have tried mapping multiple crawled properties to a RefinableString that has sort enabled but no luck in getting results sorted by Title. So far tried crawled properties (and yes, I did full crawl and waited 24 hours and can see new results updated via search query tool):
Version used 4.4.1
Describe the bug When using the "PnP - Search Results" web part, sorting by Title either results in no results shown or in an error message ([HTTP]:500 - [CorrelationId]:325d03a0-40f8-c000-8f5f-766c5dff606e [Version]:16.0.0.21903) I discovered this with a Query template with some conditions that returns both Pages and Documents. And when results are available, switching to Sort order 'Title' always results in the error. But for reproduction purposes I was able to reproduce it with the default configuration of the web part.
To Reproduce Steps to reproduce the behavior:
Expected behavior Sorting by 'Title' works
Screenshots No screenshots
Desktop (please complete the following information): Desktop: Tested with Firefox and Edge (Chromium), both are up-to-date
Additional context SharePoint Online Communication Site part of a Hub Search Results are fetched from other sites in the Hub