build_suggestions.sh 557 Bytes
#!/usr/bin/env bash
#
# Convenience script to rebuild suggestion index for a tenant.
#
# Usage:
#   ./scripts/build_suggestions.sh <tenant_id> [--days 30] [--batch-size 500] [--min-query-len 1] [--es-host http://localhost:9200]
#

set -euo pipefail

if [ $# -lt 1 ]; then
  echo "Usage: $0 <tenant_id> [extra args...]"
  echo "Example: $0 162 --days 30 --recreate"
  exit 1
fi

TENANT_ID="$1"
shift || true

ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"

cd "$ROOT_DIR"

python main.py build-suggestions \
  --tenant-id "$TENANT_ID" \
  "$@"