Metadata-Version: 2.1
Name: dmse
Version: 3.1.0
Summary: Search Service for Darsman Academy
Author: Ellnamin
Author-email: ellnamin.business@gmail.com

# Darsman Search Library

## Requirements

- Python (== 3.10)
- grpcio-tools (>=1.62.1)
- pydantic (>=2.7.0)

## Installation

Run the following command using pip:

```bash
pip install dmse
```

## Sample code

```python
import asyncio
from dmse import IndexedContent

async def main():
    result = await IndexedContent().search_blog(
        search_phrase="rust",
        request_id= "request id",   # Optional: default to None
        timeout="3.5",              # Optional: override default timeout
        wait_for_ready=True         # Optional: wait for channel if not ready
    )
    print(result)

if __name__ == "__main__":
    loop = asyncio.get_event_loop()
    loop.run_until_complete(main())

```

## Env example

```python
### === SEARCH SDK CONFIG === ###

# Server config
SEARCH_SDK_HOST=127.0.0.1
SEARCH_SDK_PORT=50051
SEARCH_SDK_API_KEY=your_api_key_here

# Graceful shutdown
SEARCH_SDK_CHANNEL_SHUTDOWN_GRACE=10

# Keepalive (for long-lived connection health checks)
SEARCH_SDK_KEEPALIVE_TIME_MS=60000
SEARCH_SDK_KEEPALIVE_TIMEOUT_MS=5000
SEARCH_SDK_KEEPALIVE_PERMIT_WITHOUT_CALLS=1
SEARCH_SDK_MAX_PINGS_WITHOUT_DATA=0

# Retry policy
SEARCH_SDK_MAX_ATTEMPTS=5  # more than 5 isn't allowed by grpc
SEARCH_SDK_INITIAL_BACKOFF=0.1s
SEARCH_SDK_MAX_BACKOFF=1.5s
SEARCH_SDK_BACKOFF_MULTIPLIER=2.0
SEARCH_SDK_RETRYABLE_STATUS_CODES=["UNAVAILABLE", "RESOURCE_EXHAUSTED", "ABORTED"]

# RPC-level configs
SEARCH_SDK_WAIT_FOR_READY=true
SEARCH_SDK_TIMEOUT=5.0
```
