Forum Discussion

Hilton Giesenow's avatar
Hilton Giesenow
Brass Contributor
Jul 25, 2022

500 Error when Sorting Search Query on out of box "Title" field

I'm querying the SharePoint Online Search API to get documents from a particular site collection. If I try to sort the results on the out of box "Title" field, I get a 500 server error result, but with no useful info on what went wrong. I'm doing this using PnP JS in an SPFx webpart, but I've saved the result as PowerShell to be able to show it here. Here's the request info:

 

"{`"request`":{`"QueryTemplate`":`"(*) AND (SiteId:\`"e7b58a85-6bf7-45ec-a2bb-7a34768b34af\`") AND (IsDocument:\`"true\`") AND (contentclass:\`"STS_ListItem_DocumentLibrary\`")`",`"RowLimit`":15,`"StartRow`":0,`"EnableInterleaving`":true,`"SelectProperties`":[`"Title`",`"Path`",`"Description`",`"PictureThumbnailURL`",`"ViewsLifeTime`",`"LastModifiedTime`",`"filename`",`"FileExtension`",`"RefinableString12`",`"RefinableString13`",`"RefinableString14`",`"RefinableString15`",`"RefinableString16`",`"RefinableString17`"],`"SortList`":[{`"Property`":`"Title`",`"Direction`":0}],`"HitHighlightedProperties`":[],`"Properties`":[],`"RefinementFilters`":[],`"ReorderingRules`":[]}}"

 

This is the result:

{"odata.error":{"code":"-1, Microsoft.Office.Server.Search.REST.SearchServiceException","message":{"lang":"en-US","value":"An unknown error occurred."}}}
 
not super informative :-(. If I sort on another field, say "filename", it's fine, but that doesn't give the best user experience for what we're wanting here.
 
I've logged a service request with Microsoft, but they referred me to post here. I was hoping for a server log perhaps to get a bit more info, so in case that's possible on this post, here's the relevant info:
 
sprequestguid: a46254a0-b06e-4000-bce0-6fae551a6a03
request-id: a46254a0-b06e-4000-bce0-6fae551a6a03
x-searchinternalrequestid: a8d42f3a-e89c-ad40-ed0c-17ff5993ec39
No RepliesBe the first to reply

Resources