Select to view content in your preferred language

Unexpected functionality of Search() method in ArcGIS API for Python

792
4
11-18-2022 08:46 AM
GeorgePualwan
Occasional Contributor

Hello,

I'm encountering some odd results when using the search() method in the ArcGIS API for Python, and I don't know if this is due to user error or something else.

When using the search() method to isolate items of "type: Feature Service" within a group, depending on what "max_items" is set to, there is a drastically changes in what gets returned under "results" in the dictionary. The "total" seems to remain the same correct value regardless, but individual feature services are duplicated in the returned results to varying degrees .

For context, I am querying feature services from a group within our AGOL organization, and the expected number of returned results is 133. If max items is set to 200 or below, the returned number of results seems to remain correct. If max items is set to anything higher than that value up to 233, the result count will always match max items. Any max items amounts higher than 233 produces varying numbers of results.

Am I just understanding the functionality of these parameters incorrectly, or is this not intended behavior?

Thanks!

0 Kudos
4 Replies
jcarlson
MVP Esteemed Contributor

That's really strange and something I've not seen before.

What happens if you use max_items=-1?

- Josh Carlson
Kendall County GIS
0 Kudos
GeorgePualwan
Occasional Contributor

Interesting, so with max_items = -1, the expected count of results are returned. Does setting max_items this way act as a catch all to return all the possible returned results?

If so, that will work great for my needs. Still very odd functionality though when setting max item to something higher.

0 Kudos
jcarlson
MVP Esteemed Contributor

Yes, "-1" equates to "give me everything".

I seem to recall reading about there being a hard limit of 10,000 baked in somewhere. I could be mistaken on that.

- Josh Carlson
Kendall County GIS
0 Kudos
GeorgePualwan
Occasional Contributor

Perfect, that makes things easier. Thanks for the info!

0 Kudos