SharePoint / sp-dev-docs

SharePoint & Viva Connections Developer Documentation
https://docs.microsoft.com/en-us/sharepoint/dev/
Creative Commons Attribution 4.0 International
1.25k stars 1.01k forks source link

SharePoint REST API ViewsLifeTime null values when sorting #8247

Open xavisegura opened 2 years ago

xavisegura commented 2 years ago

What type of issue is this?

Question

What SharePoint development model, framework, SDK or API is this about?

SharePoint REST API

Target SharePoint environment

SharePoint Online

What browser(s) / client(s) have you tested

Additional environment details

Issue description

We are using REST Search API against SharePoint Online, having the requirement of sorting by ViewsLifeTime MP.

When we execute queries with a path filter, both sorting ascending and descending get proper results

/_api/search/query?querytext=%27 AND Path:"https://XXX.sharepoint.com/sites/"%27&sortlist=%27ViewsLifeTime:descending%27

image

When we filter by DepartmentId or use Multi Geo Search, both sorting ascending and descending result sets contains null values on first and last results.

/_api/search/query?querytext=%27* AND DepartmentId:"{4ddd7f1b-6b2b-4d6a-bf40-6f675b9ad453}"%27&sortlist=%27ViewsLifeTime:ascending%27

image

Question is, is there a known limitation on sorting by ViewsXX Managed Properties (tried with ViewsLifeTime, ViewsRecent and others) when applying multi geo search or department id filter? Thanks in advanced for your support!

ghost commented 2 years ago

Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.

bcameron1231 commented 2 years ago

What kind of SharePoint Content are the first and last results?

xavisegura commented 2 years ago

What kind of SharePoint Content are the first and last results?

The first and last results are of content class STS_ListItem_Events

xavisegura commented 2 years ago

We're still facing the described behavior, no changes since June. Happy to help if more information is needed,

xavisegura commented 1 year ago

We're still facing the described behavior, no changes since June 2022. Happy to help if more information is needed.

jwiersem commented 11 months ago

Also wondering what it means when ViewsLifetime is empty or null. Was the item never visited? Or just created? Want to know if we can use the query ViewsLifetime<1 in Purview to apply clean up policy.