@@ -830,16 +830,18 @@ def check_hit_count(self):
830
830
filters = self .rapi_search_args .get ('filters' )
831
831
features = self .rapi_search_args .get ('features' )
832
832
dates = self .rapi_search_args .get ('dates' )
833
- resultFields = self .rapi_search_args .get ('resultFields' )
834
- maxResults = self .rapi_search_args .get ('maxResults' )
833
+ result_fields = self .rapi_search_args .get ('resultFields' )
834
+ max_res = self .rapi_search_args .get ('maxResults' )
835
835
836
836
# Get hit count
837
837
print (f"\n Getting hit count..." )
838
838
hit_count = self .eodms_rapi .search (self .coll_id , filters , features ,
839
- dates , resultFields , maxResults ,
840
- True ).get ('hitCount' )
839
+ dates , result_fields , max_res ,
840
+ hit_count = True ).get ('hitCount' )
841
841
842
- print (f"Hit Count for Search: { hit_count } " )
842
+ msg = f"Hit Count for Search: { hit_count } "
843
+ print (f"\n { msg } " )
844
+ self .logger .info (msg )
843
845
844
846
return hit_count
845
847
@@ -1520,17 +1522,18 @@ def query_entries(self, collections, **kwargs):
1520
1522
for k , v in self .rapi_search_args .items ():
1521
1523
print (f" { k } : { v } " )
1522
1524
1523
- if max_images is None or max_images == '' :
1524
- # Check hit count for the search
1525
- hit_count = self .check_hit_count ()
1526
- max_images = hit_count
1525
+ # Check hit count for the search
1526
+ hit_count = self .check_hit_count ()
1527
1527
1528
1528
if hit_count == 0 :
1529
1529
msg = "Sorry, no results found for given AOI or filters."
1530
1530
self .print_msg (msg , heading = "warning" )
1531
1531
self .logger .warning (msg )
1532
1532
self .exit_cli ()
1533
1533
1534
+ if max_images is None or max_images == '' or max_images > hit_count :
1535
+ max_images = hit_count
1536
+
1534
1537
if max_images > 1500 :
1535
1538
msg = f"""The hit count for this search is too high. The RAPI will most likely timeout.
1536
1539
Please separate your searches into separate commands, narrowing your searches with other filters (such as adding a date range(s)).
0 commit comments