Metadata-Version: 2.4
Name: iil-platform-search
Version: 0.1.0
Summary: Platform-wide hybrid search: pgvector + FTS with Reciprocal Rank Fusion (ADR-087)
Author: Achim Dehnert
License: MIT
Requires-Python: >=3.10
Requires-Dist: django>=4.2
Requires-Dist: httpx>=0.25
Requires-Dist: numpy>=1.24
Requires-Dist: pydantic>=2.0
Provides-Extra: dev
Requires-Dist: pytest-django>=4.5; extra == 'dev'
Requires-Dist: pytest>=8.0; extra == 'dev'
Requires-Dist: respx>=0.21; extra == 'dev'
Requires-Dist: ruff>=0.4; extra == 'dev'
Description-Content-Type: text/markdown

# platform-search

> Platform-wide hybrid search: pgvector + FTS with Reciprocal Rank Fusion (ADR-087)

## Overview

Combines PostgreSQL pgvector semantic search with full-text search (FTS),
merged via Reciprocal Rank Fusion (RRF). Optional MMR diversity filter
and temporal decay scoring.

## Installation

```bash
pip install -e packages/platform-search
```

## Usage

```python
from platform_search.service import SearchService

results = SearchService.search(
    query="Gefährdungsbeurteilung Arbeitsplatz",
    tenant_id="abc-123",
    source_types=["assessment"],
    top_k=10,
)
```

## Configuration

```python
# config/settings/base.py
PLATFORM_SEARCH = {
    "EMBEDDING_PROVIDER": "openai",
    "EMBEDDING_MODEL": "text-embedding-3-small",
    "EMBEDDING_DIMENSIONS": 1536,
    "VECTOR_WEIGHT": 0.6,
    "TEXT_WEIGHT": 0.4,
    "RRF_K": 60,
    "DEFAULT_TOP_K": 10,
}
```

Requires `OPENAI_API_KEY` in Django settings (ADR-045).

## Database

Migration creates `search_chunks` table in `content_store` DB (ADR-062).
Run: `python manage.py migrate platform_search --database=content_store`

## Related ADRs

- **ADR-087**: Hybrid Search Architecture
- **ADR-062**: Content Store
- **ADR-045**: Secret Management
- **ADR-072**: Schema Isolation (Row-Level deviation documented)
