asfadmin / Discovery-asf_search

BSD 3-Clause "New" or "Revised" License
131 stars 45 forks source link

[Bug] ASFSearchResults.searchComplete incorrectly set to False for queries returning less than maxResults #204

Closed asjohnston-asf closed 1 year ago

asjohnston-asf commented 1 year ago

Describe the bug I believe the searchComplete attribute is incorrectly being set to False for searches that complete successfully but return less than maxResults. This causes ASFSearchResults.raise_if_incomplete() to raise an exception for successful searches.

To Reproduce

This query only returns 3 results, as expected, but seachComplete is False when maxResults>3

>>> asf_search.__version__
'6.5.0'
>>> params = {'beamMode': ['IW'],
...  'end': '2023-06-01T16:59:59Z',
...  'frame': [61],
...  'intersectsWith': 'POLYGON((93.4258 18.5769,94.3544 18.5769,94.3544 '
...                    '19.4733,93.6797 20.3947,92.8497 20.3947,92.8497 '
...                    '19.8044,93.4258 18.5769))',
...  'platform': 'S1',
...  'polarization': ['VV+VH'],
...  'processingLevel': 'SLC',
...  'relativeOrbit': [143],
...  'start': '2023-04-30T17:00:00Z'}

>>> results = asf_search.search(**params)
>>> len(results)
3
>>> results.searchComplete
False

>>> results = asf_search.search(**params, maxResults=4)
>>> len(results)
3
>>> results.searchComplete
False

>>> results = asf_search.search(**params, maxResults=3)
>>> len(results)
3
>>> results.searchComplete
True

Screenshot from 2023-06-15 16-56-46

asjohnston-asf commented 1 year ago

This behavior changed sometime between v6.0.2 and v6.5.0; I get searchComplete=True for the same query using v6.0.2:

>>> asf_search.__version__
'6.0.2'
>>> params = {'beamMode': ['IW'],
...  'end': '2023-06-01T16:59:59Z',
...  'frame': [61],
...  'intersectsWith': 'POLYGON((93.4258 18.5769,94.3544 18.5769,94.3544 '
...                    '19.4733,93.6797 20.3947,92.8497 20.3947,92.8497 '
...                    '19.8044,93.4258 18.5769))',
...  'platform': 'S1',
...  'polarization': ['VV+VH'],
...  'processingLevel': 'SLC',
...  'relativeOrbit': [143],
...  'start': '2023-04-30T17:00:00Z'}
>>> results = asf_search.search(**params)
>>> len(results)
3
>>> results.searchComplete
True
SpicyGarlicAlbacoreRoll commented 1 year ago

This issue has been fixed as of v6.6.2 https://github.com/asfadmin/Discovery-asf_search/releases/tag/v6.6.2