arcgis-python-api icon indicating copy to clipboard operation
arcgis-python-api copied to clipboard

The filter parameter in gis.content.search() are only used if max_items <= 100

Open HakonD opened this issue 6 months ago • 0 comments
trafficstars

Describe the bug When searching for items in the GIS the filter parameter are not used if max_items > 100 or not set. Thus returning all items or only 10.

Additionally, even when the filter is used, the result contains several hits that does not honor the filter but this is a less serious problem.

To Reproduce Steps to reproduce the behavior:

Sign in to a GIS with one or more Service Proxy items (or modify the code to use a different keyword), and run the added code.

import arcgis

_gis = arcgis.GIS(.....)

_items = _gis.content.search(query="", filter="typeKeywords:Service Proxy")
print(f"Found {len(_items)} items")

_items = _gis.content.search(query="", filter="typeKeywords:Service Proxy", max_items=10)
print(f"Found {len(_items)} items")

_items = _gis.content.search(query="", filter="typeKeywords:Service Proxy", max_items=101)
print(f"Found {len(_items)} items")

error: Code runs, but returns erroneous result.

Screenshots

Image The correct number of 'Service Proxy' items in this portal is 5.

Expected behavior I would expect the code to return the 5 correct items.

Platform (please complete the following information):

  • Python API Version: 2.4.1
  • ArcGIS Enterprise 11.3 Windows

Additional info

The query [myAGE]/portal/home/content.html?sortField=relevance&sortOrder=desc&searchTerm=typekeywords%3A"Service+Proxy"&view=table#org returns the correct number of items.

HakonD avatar May 21 '25 10:05 HakonD