Files
lasuite-drive/docs/setup-find.md
T
Fabre FlorianandQuentin BEY 03124f4bf1 (backend) add indexed search feature flag
Add setting FEATURES_INDEXED_SEARCH that allows to disable the
search of indexed files while using the indexation tools.

Signed-off-by: Fabre Florian <ffabre@hybird.org>
2025-12-16 22:50:25 +01:00

52 lines
2.0 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Setup the Find search for Drive
This configuration will enable the fulltext search feature for Drive :
- Each save on **core.Item** or **core.Item** will trigger the indexer
- Once indexer service configured, the `api/v1.0/item/search/` will work as a proxy with the Find API for fulltext search.
## Create an index service for Drive
Configure a **Service** for Drive application with these settings
- **Name**: `drive`<br>_request.auth.name of the Drive application._
- **Client id**: `drive`<br>_Name of the token audience or client_id of the Drive application._
See [how-to-use-indexer.md](how-to-use-indexer.md) for details.
## Configure settings of Drive
Add those Django settings the Drive application to enable the indexation feature.
```python
SEARCH_INDEXER_CLASS="core.services.search_indexers.SearchIndexer"
SEARCH_INDEXER_COUNTDOWN=10 # Debounce delay in seconds for the indexer calls.
# The token from service "drive" of Find application (development)
SEARCH_INDEXER_SECRET=find-api-key-for-driv-with-exactly-50-chars-length
SEARCH_INDEXER_URL="http://find:8000/api/v1.0/documents/index/"
# Search endpoint. Uses the OIDC token for authentication
SEARCH_INDEXER_QUERY_URL="http://find:8000/api/v1.0/documents/search/"
# Maximum number of results expected from the search endpoint
SEARCH_INDEXER_QUERY_LIMIT=50
# Limit the mimetypes and size of indexable files
SEARCH_INDEXER_ALLOWED_MIMETYPES=["text/"]
SEARCH_INDEXER_CONTENT_MAX_SIZE=2 * 2**20 # 2Mb
```
We also need to enable the **OIDC Token** refresh or the authentication will fail quickly.
```shell
# Store OIDC tokens in the session
OIDC_STORE_ACCESS_TOKEN = True # Store the access token in the session
OIDC_STORE_REFRESH_TOKEN = True # Store the encrypted refresh token in the session
OIDC_STORE_REFRESH_TOKEN_KEY = "your-32-byte-encryption-key==" # Must be a valid Fernet key (32 url-safe base64-encoded bytes)
```
And to enable the search of indexed files through the API, add this feature flag (default=True)
```python
FEATURES_INDEXED_SEARCH=True
```