{
  "name": "Momentry Video Search - Simple",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "video-search-simple",
        "responseMode": "lastNode",
        "options": {}
      },
      "id": "webhook-simple",
      "name": "Webhook (Simple)",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 1,
      "position": [
        250,
        300
      ],
      "webhookId": "video-search-simple"
    },
    {
      "parameters": {
        "url": "http://localhost:3002/api/v1/n8n/search",
        "method": "POST",
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "query",
              "value": "={{ $json.body }}"
            },
            {
              "name": "limit",
              "value": 5
            }
          ]
        },
        "options": {
          "headers": {
            "Content-Type": "application/json",
            "X-API-Key": "demo_api_key_12345"
          }
        }
      },
      "id": "http-search",
      "name": "搜尋 Momentry",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 3,
      "position": [
        500,
        300
      ]
    },
    {
      "parameters": {
        "jsCode": "// 處理 Momentry 搜尋結果\nconst data = $input.first().json;\nconst hits = data.hits;\n\nif (!hits || hits.length === 0) {\n  return {\n    json: {\n      success: false,\n      message: '找不到相關結果',\n      query: data.query\n    }\n  };\n}\n\n// 格式化結果\nconst formattedResults = hits.map((hit, idx) => {\n  return {\n    index: idx + 1,\n    id: hit.id,\n    title: hit.title,\n    text: hit.text,\n    startTime: hit.start,\n    endTime: hit.end,\n    relevance: Math.round(hit.score * 100) + '%',\n    file_path: hit.file_path\n  };\n});\n\nreturn {\n  json: {\n    success: true,\n    query: data.query,\n    totalFound: data.count,\n    results: formattedResults\n  }\n};"
      },
      "id": "code-process-simple",
      "name": "處理結果",
      "type": "n8n-nodes-base.code",
      "typeVersion": 1,
      "position": [
        750,
        300
      ]
    },
    {
      "parameters": {
        "respondWith": "json",
        "responseBody": "={{ $json }}"
      },
      "id": "respond-webhook",
      "name": "回傳結果",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1,
      "position": [
        1000,
        300
      ]
    }
  ],
  "connections": {
    "Webhook (Simple)": {
      "main": [
        [
          {
            "node": "搜尋 Momentry",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "搜尋 Momentry": {
      "main": [
        [
          {
            "node": "處理結果",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "處理結果": {
      "main": [
        [
          {
            "node": "回傳結果",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {},
  "id": "momentry-video-search-simple",
  "versionId": "1",
  "createdAt": "2026-03-23T00:00:00.000Z",
  "updatedAt": "2026-03-23T00:00:00.000Z"
}