build_suggestions.sh
854 Bytes
#!/usr/bin/env bash
#
# Convenience script to rebuild suggestion index for a tenant.
#
# Usage:
# # full rebuild + alias publish (default)
# ./scripts/build_suggestions.sh <tenant_id> --mode full --days 30
#
# # incremental update from watermark
# ./scripts/build_suggestions.sh <tenant_id> --mode incremental
#
set -euo pipefail
if [ $# -lt 1 ]; then
echo "Usage: $0 <tenant_id> [extra args...]"
echo "Example (full): $0 162 --mode full --days 30 --publish-alias"
echo "Example (incremental): $0 162 --mode incremental --overlap-minutes 30"
exit 1
fi
TENANT_ID="$1"
shift || true
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
cd "$ROOT_DIR"
PY_BIN="${PYTHON_BIN:-$ROOT_DIR/.venv/bin/python}"
if [ ! -x "$PY_BIN" ]; then
PY_BIN="python3"
fi
"$PY_BIN" main.py build-suggestions \
--tenant-id "$TENANT_ID" \
"$@"