sp-dev-docs icon indicating copy to clipboard operation
sp-dev-docs copied to clipboard

SharePoint REST API ViewsLifeTime null values when sorting

Open xavisegura opened this issue 3 years ago • 4 comments

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

  • [ ] 💥 Internet Explorer
  • [X] 💥 Microsoft Edge
  • [X] 💥 Google Chrome
  • [ ] 💥 FireFox
  • [ ] 💥 Safari
  • [ ] mobile (iOS/iPadOS)
  • [ ] mobile (Android)
  • [ ] not applicable
  • [ ] other (enter in the "Additional environment details" area below)

Additional environment details

  • browser version
  • SPFx version
  • Node.js version
  • etc

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!

xavisegura avatar Jun 30 '22 06:06 xavisegura

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

ghost avatar Jun 30 '22 06:06 ghost

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

bcameron1231 avatar Jun 30 '22 13:06 bcameron1231

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

The first and last results are of content class STS_ListItem_Events

xavisegura avatar Jun 30 '22 13:06 xavisegura

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

xavisegura avatar Oct 06 '22 08:10 xavisegura

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

xavisegura avatar Feb 03 '23 16:02 xavisegura

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.

jwiersem avatar Dec 07 '23 12:12 jwiersem