curl1.sh 643 Bytes
#!/bin/bash

start=$(date +%s%N)  # 开始时间,纳秒级

# 将 titles.400 每一行转成 JSON 数组

docs_json=$(jq -R -s 'split("\n") | map(select(length > 0))' /data/saas-search/tests/data/titles.400)

time curl -X POST "http://localhost:6007/rerank" \
  -H "Content-Type: application/json" \
  -d "$(jq -n \
    --arg query "健身女生T恤短袖" \
    --argjson docs "$docs_json" \
    '{
      query: $query,
      docs: $docs,
      top_n: 386,
      normalize: true
    }')"

end=$(date +%s%N)    # 结束时间,纳秒级
duration=$(( (end - start) / 1000000 ))  # 转换为毫秒
echo "Command took $duration milliseconds."