0

I am observing a quite strange issue, with the sharepoint rest API (SharePoint Online as well as onPrem).

We have a slightly bigger library (~100.000 documents) with some multi-level folder structure. I have two additional fields on the folder, let's call them CountryA and CountryB, both fields are indexed.

What I observe is the following:

/Items?$filter=(substringof('Ukraine',CountryA))&$select=ID (150 records)

/Items?$filter=(substringof('Spain',CountryB))&$select=ID (250 records)

/Items?$filter=(substringof('Ukraine',CountryA) and (substringof('Spain',CountryB))&$select=ID (100 records)

and now the very strange thing:

/Items?$filter=(substringof('Ukraine',CountryA) or (substringof('Spain',CountryB))&$select=ID

throws an Microsoft.SharePoint.SPQueryThrottledException

To be honest this doesn't make any sense to me; almost looks like a bug.. As I don't have much time, I "sorted" the issue by doing both single field queries rest queries in parallel and joining the result on the client side..

Anyhow any feedback is really appreciated; as I actually increase the load towards SharePoint by now throwing two rest calls in parallel on the server I just can't believe this is the "right" way to go?!

Community
  • 1
  • 1

1 Answers1

0

If the CountryA column and CountryB column are indexed, you can use the REST URL below.

/Items?$top=500&$filter=(substringof('Ukraine',CountryA) or substringof('Spain',CountryB))&$select=ID

LZ_MSFT
  • 4,079
  • 1
  • 8
  • 9
  • As stated, the query ends up with Microsoft.SharePoint.SPQueryThrottledException with or without the $top parameter. That's why I am so confused..Yes, both columns ARE indexed – dreamworks Feb 02 '18 at 15:57