|
| 1 | +"""Shared filter extension methods for stac-fastapi elasticsearch and opensearch backends. |
| 2 | +
|
| 3 | +This module provides shared functionality for implementing the STAC API Filter Extension |
| 4 | +with Elasticsearch and OpenSearch. It includes: |
| 5 | +
|
| 6 | +1. Functions for converting CQL2 queries to Elasticsearch/OpenSearch query DSL |
| 7 | +2. Helper functions for field mapping and query transformation |
| 8 | +3. Base implementation of the AsyncBaseFiltersClient for Elasticsearch/OpenSearch |
| 9 | +
|
| 10 | +The filter package is organized as follows: |
| 11 | +- cql2.py: CQL2 pattern conversion helpers |
| 12 | +- transform.py: Query transformation functions |
| 13 | +- client.py: Filter client implementation |
| 14 | +
|
| 15 | +When adding new functionality to this package, consider: |
| 16 | +1. Will this code be used by both Elasticsearch and OpenSearch implementations? |
| 17 | +2. Is the functionality stable and unlikely to diverge between implementations? |
| 18 | +3. Is the function well-documented with clear input/output contracts? |
| 19 | +
|
| 20 | +Function Naming Conventions: |
| 21 | +- Function names should be descriptive and indicate their purpose |
| 22 | +- Parameter names should be consistent across similar functions |
| 23 | +""" |
| 24 | + |
| 25 | +from .client import EsAsyncBaseFiltersClient |
| 26 | + |
| 27 | +# Re-export the main functions and classes for backward compatibility |
| 28 | +from .cql2 import _replace_like_patterns, cql2_like_to_es |
| 29 | +from .transform import to_es, to_es_field |
| 30 | + |
| 31 | +__all__ = [ |
| 32 | + "cql2_like_to_es", |
| 33 | + "_replace_like_patterns", |
| 34 | + "to_es_field", |
| 35 | + "to_es", |
| 36 | + "EsAsyncBaseFiltersClient", |
| 37 | +] |
0 commit comments