Files
docs/docs/search.md
Fabre Florian c24f46067b (backend) adapt to Find new search pagination
Use nb_results instead of page/page_size argument for /search API.

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

1.7 KiB

Setup the Find search for Impress

This configuration will enable the fulltext search feature for Docs :

  • Each save on core.Document or core.DocumentAccess will trigger the indexer
  • The api/v1.0/documents/search/ will work as a proxy with the Find API for fulltext search.

Create an index service for Docs

Configure a Service for Docs application with these settings

  • Name: docs
    request.auth.name of the Docs application.
  • Client id: impress
    Name of the token audience or client_id of the Docs application.

See how-to-use-indexer.md for details.

Configure settings of Docs

Add those Django settings the Docs application to enable the feature.

SEARCH_INDEXER_CLASS="core.services.search_indexers.FindDocumentIndexer"
SEARCH_INDEXER_COUNTDOWN=10  # Debounce delay in seconds for the indexer calls.

# The token from service "docs" of Find application (development).
SEARCH_INDEXER_SECRET="find-api-key-for-docs-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

We also need to enable the OIDC Token refresh or the authentication will fail quickly.

# 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)