def _to_lance_filter(standard_filters: MetadataFilters, metadata_keys: list) -> Any:
    """Translate standard metadata filters to Lance specific spec."""
    filters = []
    for filter in standard_filters.filters:
        key = filter.key
        if filter.key in metadata_keys:
            key = f"metadata.{filter.key}"
        if (
            filter.operator == FilterOperator.TEXT_MATCH
            or filter.operator == FilterOperator.NE
        ):
            filters.append(
                key + sql_operator_mapper[filter.operator] + f"'%{filter.value}%'"
            )
        if isinstance(filter.value, list):
            val = ",".join(filter.value)
            filters.append(key + sql_operator_mapper[filter.operator] + f"({val})")
        elif isinstance(filter.value, int):
            filters.append(
                key + sql_operator_mapper[filter.operator] + f"{filter.value}"
            )
        else:
            filters.append(
                key + sql_operator_mapper[filter.operator] + f"'{filter.value!s}'"
            )

    if standard_filters.condition == FilterCondition.OR:
        return " OR ".join(filters)
    else:
        return " AND ".join(filters)
Translate standard metadata filters to Lance specific spec.
llama-index-integrations/vector_stores/llama-index-vector-stores-lancedb/llama_index/vector_stores/lancedb/base.py