{
  "name": "Nodbot - Qdrant RAG retrieval with metadata filters",
  "nodes": [
    {
      "parameters": {
        "path": "integration-qdrant-n8n",
        "httpMethod": "POST",
        "responseMode": "responseNode"
      },
      "id": "587c6ed5-0ed0-497b-a4c9-3c12dff75115",
      "name": "Webhook question/input",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        0,
        260
      ]
    },
    {
      "parameters": {
        "jsCode": "const doc = $json.body ?? $json;\nconst text = String(doc.text ?? '').replace(/\\s+/g, ' ').trim();\nif (text.length < 200) throw new Error('Document text is too short for RAG indexing');\nconst chunkSize = Number($env.RAG_CHUNK_SIZE ?? 900);\nconst overlap = Number($env.RAG_CHUNK_OVERLAP ?? 120);\nconst chunks = [];\nfor (let start = 0, i = 0; start < text.length; start += chunkSize - overlap, i++) {\n  const chunk = text.slice(start, start + chunkSize).trim();\n  if (chunk.length < 120) continue;\n  chunks.push({\n    id: `${doc.document_id}:${doc.doc_version}:${i}`,\n    text: chunk,\n    payload: {\n      document_id: doc.document_id,\n      doc_version: doc.doc_version,\n      source_url: doc.source_url,\n      language: doc.language ?? 'ru',\n      product: doc.product ?? 'general',\n      status: doc.status ?? 'published',\n      chunk_index: i\n    }\n  });\n}\nreturn chunks.map(c => ({ json: c }));"
      },
      "id": "31046ee1-1b4c-44c9-957b-dd431fee5e5c",
      "name": "Chunk or normalize query",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        280,
        260
      ]
    },
    {
      "parameters": {},
      "id": "2c90efec-d046-4f7c-bfb9-a745de7bd5ff",
      "name": "Create embedding",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 2,
      "position": [
        560,
        260
      ]
    },
    {
      "parameters": {},
      "id": "fbbee5b9-a124-48bd-89ed-235039455a0c",
      "name": "Qdrant upsert/search",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 2,
      "position": [
        840,
        260
      ]
    },
    {
      "parameters": {
        "jsCode": "const doc = $json.body ?? $json;\nconst text = String(doc.text ?? '').replace(/\\s+/g, ' ').trim();\nif (text.length < 200) throw new Error('Document text is too short for RAG indexing');\nconst chunkSize = Number($env.RAG_CHUNK_SIZE ?? 900);\nconst overlap = Number($env.RAG_CHUNK_OVERLAP ?? 120);\nconst chunks = [];\nfor (let start = 0, i = 0; start < text.length; start += chunkSize - overlap, i++) {\n  const chunk = text.slice(start, start + chunkSize).trim();\n  if (chunk.length < 120) continue;\n  chunks.push({\n    id: `${doc.document_id}:${doc.doc_version}:${i}`,\n    text: chunk,\n    payload: {\n      document_id: doc.document_id,\n      doc_version: doc.doc_version,\n      source_url: doc.source_url,\n      language: doc.language ?? 'ru',\n      product: doc.product ?? 'general',\n      status: doc.status ?? 'published',\n      chunk_index: i\n    }\n  });\n}\nreturn chunks.map(c => ({ json: c }));"
      },
      "id": "d8d975b8-fcba-4d04-92ed-62562ed83021",
      "name": "Validate sources",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1120,
        260
      ]
    },
    {
      "parameters": {},
      "id": "37d0fd97-a47d-48ba-9a0c-0226d5e6560c",
      "name": "Respond with citations",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 2,
      "position": [
        1400,
        260
      ]
    }
  ],
  "connections": {
    "Webhook question/input": {
      "main": [
        [
          {
            "node": "Chunk or normalize query",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Chunk or normalize query": {
      "main": [
        [
          {
            "node": "Create embedding",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create embedding": {
      "main": [
        [
          {
            "node": "Qdrant upsert/search",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Qdrant upsert/search": {
      "main": [
        [
          {
            "node": "Validate sources",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Validate sources": {
      "main": [
        [
          {
            "node": "Respond with citations",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "staticData": null,
  "tags": [
    "nodbot",
    "integration",
    "production"
  ],
  "triggerCount": 1,
  "updatedAt": "2026-05-30T00:00:00.000Z",
  "versionId": "adeaa7c3-ce40-4f29-a6a8-258ea1fc4d7c",
  "meta": {
    "templateCredsSetupCompleted": false
  }
}