Skip to content

Commit

Permalink
clean up warnings, tests
Browse files Browse the repository at this point in the history
  • Loading branch information
hrodmn committed Oct 10, 2024
1 parent 1296aa7 commit ee88cef
Show file tree
Hide file tree
Showing 6 changed files with 546 additions and 142 deletions.
7 changes: 3 additions & 4 deletions pystac_client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -734,11 +734,10 @@ def collection_search(
if not (
self.conforms_to(ConformanceClasses.COLLECTION_SEARCH)
or self.conforms_to(ConformanceClasses.COLLECTIONS)
):
) and any([bbox, datetime, q, query, filter, sortby, fields]):
raise DoesNotConformTo(
"COLLECTION_SEARCH",
"COLLECTIONS",
"There is no fallback option available for search.",
"COLLECTION_SEARCH or COLLECTIONS",
"there is no fallback option available for search.",
)

return CollectionSearch(
Expand Down
25 changes: 13 additions & 12 deletions pystac_client/collection_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,20 +281,21 @@ def __init__(
self._collection_search_free_text_enabled = client.conforms_to(
ConformanceClasses.COLLECTION_SEARCH_FREE_TEXT
)
if not self._collection_search_extension_enabled:
warnings.warn(
str(DoesNotConformTo("COLLECTION_SEARCH"))
+ ". Filtering will be performed client-side where only bbox, "
"datetime, and q arguments are supported"
)
self._validate_client_side_args()
else:
if not self._collection_search_free_text_enabled:
if any([bbox, datetime, q, query, filter, sortby, fields]):
if not self._collection_search_extension_enabled:
warnings.warn(
str(DoesNotConformTo("COLLECTION_SEARCH#FREE_TEXT"))
+ ". Free-text search is not enabled for collection search"
"Free-text filters will be applied client-side."
str(DoesNotConformTo("COLLECTION_SEARCH"))
+ ". Filtering will be performed client-side where only bbox, "
"datetime, and q arguments are supported"
)
self._validate_client_side_args()
else:
if not self._collection_search_free_text_enabled:
warnings.warn(
str(DoesNotConformTo("COLLECTION_SEARCH#FREE_TEXT"))
+ ". Free-text search is not enabled for collection search"
"Free-text filters will be applied client-side."
)

else:
self._stac_io = stac_io or StacApiIO()
Expand Down
Loading

0 comments on commit ee88cef

Please sign in to comment.