"""Common utilities - re-exports for backwards compatibility.

For new code, prefer importing from specific modules:
    from full_text_search.types import SearchResult, SearchResultContent
    from full_text_search.base import SearchIndex
    from full_text_search.filters import filter_document_content
    from full_text_search.dedup import deduplicate_exact, deduplicate_fuzzy
"""

# Core types (no external deps)
from .types import SearchResult, SearchResultContent

# Abstract base (no external deps)
from .base import SearchIndex

# Content filtering (no external deps)
from .filters import filter_document_content


# Deduplication (requires ingest extras: lenlp, rapidfuzz)
# Lazy import to avoid requiring ingest deps at import time
def deduplicate_exact(records: list[dict], deduplicate_by: str) -> list[dict]:
    """Remove exact duplicates. Requires 'ingest' extra."""
    from .dedup import deduplicate_exact as _deduplicate_exact

    return _deduplicate_exact(records, deduplicate_by)


def deduplicate_fuzzy(
    records: list[dict], deduplicate_by: str, cutoff: float = 95
) -> list[dict]:
    """Remove fuzzy duplicates. Requires 'ingest' extra."""
    from .dedup import deduplicate_fuzzy as _deduplicate_fuzzy

    return _deduplicate_fuzzy(records, deduplicate_by, cutoff)


__all__ = [
    "SearchResult",
    "SearchResultContent",
    "SearchIndex",
    "filter_document_content",
    "deduplicate_exact",
    "deduplicate_fuzzy",
]
