| 
31 | 31 | from stac_fastapi.extensions.core import (  | 
32 | 32 |     AggregationExtension,  | 
33 | 33 |     CollectionSearchExtension,  | 
 | 34 | +    CollectionSearchFilterExtension,  | 
34 | 35 |     FilterExtension,  | 
35 | 36 |     FreeTextExtension,  | 
36 | 37 |     SortExtension,  | 
 | 
39 | 40 | )  | 
40 | 41 | from stac_fastapi.extensions.core.fields import FieldsConformanceClasses  | 
41 | 42 | from stac_fastapi.extensions.core.filter import FilterConformanceClasses  | 
 | 43 | +from stac_fastapi.extensions.core.free_text import FreeTextConformanceClasses  | 
42 | 44 | from stac_fastapi.extensions.core.query import QueryConformanceClasses  | 
43 | 45 | from stac_fastapi.extensions.core.sort import SortConformanceClasses  | 
44 | 46 | from stac_fastapi.extensions.third_party import BulkTransactionExtension  | 
 | 
69 | 71 |     FilterConformanceClasses.ADVANCED_COMPARISON_OPERATORS  | 
70 | 72 | )  | 
71 | 73 | 
 
  | 
72 |  | -# Adding collection search extension for compatibility with stac-auth-proxy  | 
73 |  | -# (https://github.com/developmentseed/stac-auth-proxy)  | 
74 |  | -# The extension is not fully implemented yet but is required for collection filtering support  | 
75 | 74 | collection_search_extension = CollectionSearchExtension()  | 
76 | 75 | collection_search_extension.conformance_classes.append(  | 
77 | 76 |     "https://api.stacspec.org/v1.0.0-rc.1/collection-search#filter"  | 
 | 
122 | 121 | 
 
  | 
123 | 122 | extensions = [aggregation_extension] + search_extensions  | 
124 | 123 | 
 
  | 
 | 124 | +# Create collection search extensions  | 
 | 125 | +# Only sort extension is enabled for now  | 
 | 126 | +collection_search_extensions = [  | 
 | 127 | +    QueryExtension(conformance_classes=[QueryConformanceClasses.COLLECTIONS]),  | 
 | 128 | +    SortExtension(conformance_classes=[SortConformanceClasses.COLLECTIONS]),  | 
 | 129 | +    FieldsExtension(conformance_classes=[FieldsConformanceClasses.COLLECTIONS]),  | 
 | 130 | +    CollectionSearchFilterExtension(  | 
 | 131 | +        conformance_classes=[FilterConformanceClasses.COLLECTIONS]  | 
 | 132 | +    ),  | 
 | 133 | +    FreeTextExtension(conformance_classes=[FreeTextConformanceClasses.COLLECTIONS]),  | 
 | 134 | +]  | 
 | 135 | + | 
 | 136 | +# Initialize collection search with its extensions  | 
 | 137 | +collection_search_ext = CollectionSearchExtension.from_extensions(  | 
 | 138 | +    collection_search_extensions  | 
 | 139 | +)  | 
 | 140 | +collections_get_request_model = collection_search_ext.GET  | 
 | 141 | + | 
 | 142 | +extensions.append(collection_search_ext)  | 
 | 143 | + | 
125 | 144 | database_logic.extensions = [type(ext).__name__ for ext in extensions]  | 
126 | 145 | 
 
  | 
127 | 146 | post_request_model = create_post_request_model(search_extensions)  | 
 | 
154 | 173 |         post_request_model=post_request_model,  | 
155 | 174 |         landing_page_id=os.getenv("STAC_FASTAPI_LANDING_PAGE_ID", "stac-fastapi"),  | 
156 | 175 |     ),  | 
 | 176 | +    "collections_get_request_model": collections_get_request_model,  | 
157 | 177 |     "search_get_request_model": create_get_request_model(search_extensions),  | 
158 | 178 |     "search_post_request_model": post_request_model,  | 
159 | 179 |     "items_get_request_model": items_get_request_model,  | 
 | 
0 commit comments