# स्व-शोषण सदिश डाटाबेस क्यूवर के साथ: एक गहरा नृत्य

<datetime class="hidden">2025-11-23T13:00</datetime>

<!-- category -- ASP.NET, Semantic Search, Vector Databases, Qdrant, RAG, AI-Article -->
# परिचय

**RAG से संबंधित:** इस लेख में क्यूवेवर में एक गहरा रिलेक्ट प्रदान किया गया है, सदिश डाटाबेस जिसमें उपयोग में लिया गया है:

- [एक भाग ४: ऑन- पृष्ठ (N)](/blog/semantic-search-with-onnx-and-qdrant) - निर्माण स्थल खोज
- [पार्ट 5: Hybd खोज स्वचलित किया जा रहा है](/blog/rag-hybrid-search-and-indexing) - उत्पाद एकीकरण

[स्केल्स](https://qdrant.tech/) (Applause.) एक ओपन-source वेक्टर डाटाबेस है जो रस्ट में बनाया गया है. इस लेख में मुख्य धारणाएँ, सी# ग्राहक, प्रदर्शनिंग, और उत्पादन पैटर्न.

[TOC]

# क्वीप क्या है?

ए [सदिश डाटाबेस](https://qdrant.tech/documentation/overview/) उच्च- चिप वेक्टर भंडारित करता है (एमसेलिंग्स) और तेज समानता खोज सक्षम करता है. पारंपरिक डाटाबेस से अलग है जो सटीक मिलते हैं, Qdctial पाया जाता है *इसी तरह की ज़्यादती* वस्तु.

```mermaid
flowchart LR
    A[Text: 'Docker deployment'] --> B[Embedding Model]
    B --> C["Vector: [0.12, -0.34, 0.56, ...]"]
    C --> D[Qdrant]
    E[Query: 'container setup'] --> F[Embedding Model]
    F --> G["Vector: [0.11, -0.32, 0.58, ...]"]
    G --> H[Similarity Search]
    D --> H
    H --> I[Similar Results]

    style B stroke:#6366f1,stroke-width:3px
    style D stroke:#ef4444,stroke-width:3px
    style F stroke:#6366f1,stroke-width:3px
    style H stroke:#10b981,stroke-width:2px
```

**कुंजी हटाया गया गुण:**

- [प्रवेश इंडेक्सिंग](https://qdrant.tech/documentation/concepts/indexing/) - उप- पंक्ति खोज समय
- [फ़िल्टर किया जा रहा है](https://qdrant.tech/documentation/concepts/filtering/) - समानता समानता मेटाडाटा फिल्टर सहित खोजGenericName
- [ग्नूपीसी & रिटाक्स](https://qdrant.tech/documentation/interfaces/) - उच्च-स्थान पहुँच
- [ट्रैक जानकारी](https://qdrant.tech/documentation/guides/distributed_deployment/) - आड़ा स्केल करें
- [स्नेपशॉट](https://qdrant.tech/documentation/concepts/snapshots/) - बैकअप और पुनर्भंडारण

# कोरलेट्स

## संग्रह

ए [संग्रह](https://qdrant.tech/documentation/concepts/collections/) एक तालिका की तरह यह वेक्टर एक निश्चित आयाम और दूरी के साथ रहता है... / मैं

```mermaid
flowchart TB
    subgraph Collection["Collection: blog_posts"]
        A[Vector Size: 384]
        B[Distance: Cosine]
        C[HNSW Index]
    end

    subgraph Points
        D[Point 1: slug=docker-intro]
        E[Point 2: slug=kubernetes-basics]
        F[Point N...]
    end

    Collection --> Points

    style A stroke:#6366f1,stroke-width:2px
    style B stroke:#6366f1,stroke-width:2px
    style C stroke:#f59e0b,stroke-width:2px
    style D stroke:#10b981,stroke-width:2px
    style E stroke:#10b981,stroke-width:2px
```

```csharp
// Create collection - see https://qdrant.tech/documentation/concepts/collections/#create-a-collection
await client.CreateCollectionAsync(
    collectionName: "blog_posts",
    vectorsConfig: new VectorParams
    {
        Size = 384,              // Must match your embedding model
        Distance = Distance.Cosine  // Best for text embeddings
    }
);
```

**दूरी बीजीय** ([Docs](https://qdrant.tech/documentation/concepts/collections/#distance-metrics)):

- **कोसाइन** - सदिशों के बीच कोण मापें ( पाठ के लिए सबसे अच्छा)
- **डॉट** - आंतरिक उत्पाद (सामान्य रूप से सामान्य सदिश के लिए)
- **यूक्लिड** - ज्यामितीय दूरी (सियल डाटा के लिए)

## अंक

ए [बिन्दु](https://qdrant.tech/documentation/concepts/points/) एक लिखा हुआ दफ़तर है जिसमें शयातीन के (आमाल दर्ज हैं)

```mermaid
flowchart LR
    subgraph Point
        A[ID: uuid/int]
        B["Vector: float[384]"]
        C[Payload: JSON metadata]
    end

    style A stroke:#8b5cf6,stroke-width:2px
    style B stroke:#f59e0b,stroke-width:2px
    style C stroke:#10b981,stroke-width:2px
```

```csharp
// Upsert points - see https://qdrant.tech/documentation/concepts/points/#upload-points
var point = new PointStruct
{
    Id = new PointId { Uuid = Guid.NewGuid().ToString() },
    Vectors = embedding,  // float[384]
    Payload =
    {
        ["slug"] = "my-post",
        ["title"] = "Vector Databases",
        ["language"] = "en",
        ["categories"] = new[] { "AI", "Databases" },
        ["published"] = DateTimeOffset.UtcNow.ToUnixTimeSeconds()
    }
};

await client.UpsertAsync("blog_posts", points: new[] { point });
```

## फ़िल्टर किया जा रहा है

[फ़िल्टर किया जा रहा है](https://qdrant.tech/documentation/concepts/filtering/) भागें *पहले* समानता खोज - अति कुशल है ।

```mermaid
flowchart TB
    A[Search Query] --> B{Apply Filters First}
    B --> C[Language = 'en']
    B --> D[Year >= 2024]
    C --> E[Filtered Subset]
    D --> E
    E --> F[Vector Similarity Search]
    F --> G[Ranked Results]

    style B stroke:#ec4899,stroke-width:3px
    style E stroke:#f59e0b,stroke-width:2px
    style F stroke:#6366f1,stroke-width:2px
    style G stroke:#10b981,stroke-width:2px
```

```csharp
// Filter conditions - see https://qdrant.tech/documentation/concepts/filtering/#filtering-conditions
var filter = new Filter
{
    Must =  // AND conditions
    {
        new Condition { Field = new FieldCondition
        {
            Key = "language",
            Match = new Match { Keyword = "en" }
        }},
        new Condition { Field = new FieldCondition
        {
            Key = "published",
            Range = new Range { Gte = 1704067200 }  // 2024-01-01
        }}
    },
    MustNot =  // Exclude conditions
    {
        new Condition { Field = new FieldCondition
        {
            Key = "slug",
            Match = new Match { Keyword = "draft-post" }
        }}
    }
};
```

**फ़िल्टर क़िस्म** ([Docs](https://qdrant.tech/documentation/concepts/filtering/#match)):

- `Match.Keyword` - सटीक स्ट्रिंग मिलान
- `Match.Text` - पूर्ण पाठ जोड़
- `Match.Any` - किसी भी क्रम में मिलाएँ
- `Range` - न्यूमेरिक सीमाएँ (Gt, Lt, Lt, Lt)
- `GeoBoundingBox` / `GeoRadius` - ढूंढें पंक्ति

# C# क्लाएंट

आधिकारिक संस्थापित करें [क्यूवर.Cartent](https://www.nuget.org/packages/Qdrant.Client) पैकेज (S)[GiHh](https://github.com/qdrant/qdrant-dotnet)):

```bash
dotnet add package Qdrant.Client
```

## कनेक्शन सेटअप

```csharp
using Qdrant.Client;
using Qdrant.Client.Grpc;

// gRPC client (recommended) - see https://qdrant.tech/documentation/interfaces/#grpc-interface
var client = new QdrantClient(
    host: "localhost",
    port: 6334,  // gRPC port (6333 is REST)
    https: false
);

// With API key - see https://qdrant.tech/documentation/guides/security/
var secureClient = new QdrantClient(
    host: "your-qdrant.cloud",
    port: 6334,
    https: true,
    apiKey: "your-api-key"
);
```

> **हमेशा gRPC का प्रयोग करें** (पोर्ट 6334) उत्पादन के लिए - 3-5x तेजी से

## विंडोज़ एचटीटीपी/2 ठीक

विंडोज़ पर, अनएनक्रिप्टेड HTTP/2 सक्षम करें **पहले** क्लाएंट बनाया जा रहा है:

```csharp
AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport", true);
```

## कुंजी संचालन

### ढूंढें

```csharp
// Vector search - see https://qdrant.tech/documentation/concepts/search/
var results = await client.SearchAsync(
    collectionName: "blog_posts",
    vector: queryEmbedding,
    limit: 10,
    filter: filter,
    scoreThreshold: 0.5f,  // Minimum similarity
    searchParams: new SearchParams
    {
        HnswEf = 128,  // Search accuracy (higher = better recall)
        Exact = false  // Use approximate search
    },
    withPayload: true
);

foreach (var result in results)
{
    Console.WriteLine($"{result.Payload["title"].StringValue}: {result.Score}");
}
```

### बैच अप जिन्हों ने भेंट की है

```csharp
// Batch operations - see https://qdrant.tech/documentation/concepts/points/#batch-update
var points = documents.Select(doc => new PointStruct
{
    Id = new PointId { Uuid = doc.Id },
    Vectors = doc.Embedding,
    Payload = { ["slug"] = doc.Slug, ["title"] = doc.Title }
}).ToList();

await client.UpsertAsync(
    collectionName: "blog_posts",
    points: points,
    wait: true  // Wait for indexing
);
```

### मिटाएँ

```csharp
// Delete by filter - see https://qdrant.tech/documentation/concepts/points/#delete-points
await client.DeleteAsync(
    collectionName: "blog_posts",
    filter: new Filter
    {
        Must = { new Condition { Field = new FieldCondition
        {
            Key = "slug",
            Match = new Match { Keyword = "old-post" }
        }}}
    }
);
```

# प्रवेश निर्देशिका स्टिकिंग

[एचडबल्यू](https://qdrant.tech/documentation/concepts/indexing/#vector-index) (Hrigigoglable छोटी दुनिया) Qdict की निर्देशिका एल्गोरिथ्म है.

```mermaid
flowchart TB
    subgraph "HNSW Graph Layers"
        L2[Layer 2 - Sparse]
        L1[Layer 1 - Medium]
        L0[Layer 0 - Dense]
    end

    Q[Query] --> L2
    L2 --> L1
    L1 --> L0
    L0 --> R[Nearest Neighbors]

    style L2 stroke:#8b5cf6,stroke-width:2px
    style L1 stroke:#6366f1,stroke-width:2px
    style L0 stroke:#3b82f6,stroke-width:2px
    style Q stroke:#10b981,stroke-width:2px
    style R stroke:#ef4444,stroke-width:2px
```

## निर्देशिका पैरामीटर

```csharp
// HNSW config - see https://qdrant.tech/documentation/concepts/indexing/#hnsw-index
var hnswConfig = new HnswConfigDiff
{
    M = 16,              // Edges per node (16-32 recommended)
    EfConstruct = 100,   // Build-time accuracy (100-200)
    FullScanThreshold = 10000  // Brute force threshold
};

await client.UpdateCollectionAsync(
    collectionName: "blog_posts",
    hnswConfig: hnswConfig
);
```

**खोज- समय सटीकता:**

```csharp
var searchParams = new SearchParams
{
    HnswEf = 128  // Higher = better recall, slower (64-256)
};
```

**विन्यास निर्देश:**
केस केस का प्रयोग करें (c)
|----------|---|-------------|--------|
सेंटीमीटर तेज, कम याद करते हुए
खुदा ने फरमाया कि हम 28,000 लोगों की मदद करें, जो आज तकदीर में विश्‍वास करते हैं
IMTER उच्च याद करते हुए 32 GiL 20004 गुज़रती है

# निर्देशिका फिर से लोड करें (o)

बनाएँ [निर्देशिका लोड करें](https://qdrant.tech/documentation/concepts/indexing/#payload-index) बार- बार फिल्टर किए गए क्षेत्र के लिए:

```csharp
// Keyword index - see https://qdrant.tech/documentation/concepts/indexing/#payload-index
await client.CreatePayloadIndexAsync(
    collectionName: "blog_posts",
    fieldName: "language",
    schemaType: PayloadSchemaType.Keyword
);

// Integer index for ranges
await client.CreatePayloadIndexAsync(
    collectionName: "blog_posts",
    fieldName: "published",
    schemaType: PayloadSchemaType.Integer
);
```

**प्रभाव:** 10-100x तेजी से बड़े संग्रह पर फिल्टर.

# क्वाडेंसाइजेशन

[क्वाडेंसाइजेशन](https://qdrant.tech/documentation/guides/quantization/) मेमोरी उपयोग कम करता है:

```csharp
// Scalar quantization - see https://qdrant.tech/documentation/guides/quantization/#scalar-quantization
await client.UpdateCollectionAsync(
    collectionName: "blog_posts",
    quantizationConfig: new ScalarQuantization
    {
        Scalar = new ScalarQuantizationConfig
        {
            Type = ScalarType.Int8,  // float32 -> int8
            Quantile = 0.99f,
            AlwaysRam = true
        }
    }
);
```

**ट्रायल- ऑफः** 4x कम स्मृति, ~2% याद है नुकसान, 1.x तेजी से खोज.

# डॉक नाइटिंगमेंट

```yaml
# docker-compose.yml - see https://qdrant.tech/documentation/guides/installation/
services:
  qdrant:
    image: qdrant/qdrant:v1.12.1  # Pin version!
    ports:
      - "6333:6333"  # REST
      - "6334:6334"  # gRPC
    volumes:
      - qdrant_data:/qdrant/storage
    environment:
      - QDRANT__SERVICE__GRPC_PORT=6334
      - QDRANT__SERVICE__HTTP_PORT=6333
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:6333/health"]
      interval: 30s
      timeout: 10s
      retries: 3

volumes:
  qdrant_data:
```

## सुरक्षा

सक्षम करें [API कुंजी सत्यापन](https://qdrant.tech/documentation/guides/security/):

```yaml
environment:
  - QDRANT__SERVICE__API_KEY=your-secret-key
```

# मॉनीटर किया जा रहा है

## मेट्रिक्स

कनवर्से्शन पिक्शन्स [दिल की धड़कन](https://qdrant.tech/documentation/guides/monitoring/) पर `/metrics`:

```bash
curl http://localhost:6333/metrics
```

कुंजी बीजीयः

- `qdrant_collections_vector_count` - कुल सदिश
- `qdrant_rest_responses_duration_seconds` - लंबी मुद्रा क्वैरी करें
- `qdrant_memory_usage_bytes` - मेमोरी पीने

## स्नेपशॉट

बनाएँ [बैकअप्स](https://qdrant.tech/documentation/concepts/snapshots/):

```bash
# Create snapshot
curl -X POST http://localhost:6333/collections/blog_posts/snapshots

# List snapshots
curl http://localhost:6333/collections/blog_posts/snapshots

# Restore (copy snapshot to storage/collections/blog_posts/snapshots/)
```

# सामान्य मिल गया

## 1. पोर्ट कॉनचैंट

- **6333** = rebe API
- **6334** = gRPC एपीआई (इसे प्रयोग करें!)

## 2. सदिश आयामी फार्मेट

```
Error: expected dim: 384, got 768
```

आपके एम्बेडिंग मॉडल और संग्रह से मेल खाना चाहिए:

- `all-MiniLM-L6-v2`: 384 आयाम
- `nomic-embed-text`: 768 आयाम
- डाटा आयात करें `text-embedding-3-small`: 1536 आयाम

## 3. धीमा पहला प्रश्न

प्रारंभ होने के बाद आलसीपन की स्मृति में डाल देता है.

```csharp
await client.SearchAsync("blog_posts", new float[384], limit: 1);
```

## 4. आररे फ़िल्टरिंग

प्रयोक्ता `Match.Any` ऐरे क्षेत्रों के लिए:

```csharp
new Match { Any = new RepeatedStrings { Strings = { "AI", "ML" } } }
```

# संसाधन

## आधिकारिक क्वीशन दस्तावेज़ीकरण

- [ओवरव्यू](https://qdrant.tech/documentation/overview/) - शुरू हो रहा है
- [जोड़ा गया](https://qdrant.tech/documentation/concepts/) - कोर धारणाएँ
- [संग्रह](https://qdrant.tech/documentation/concepts/collections/) - संग्रह बनाया जा रहा है और संभाल रहा है
- [अंक](https://qdrant.tech/documentation/concepts/points/) - सदिश के साथ काम कर रहा है
- [ढूंढें](https://qdrant.tech/documentation/concepts/search/) - क्वैरी संचालन
- [फ़िल्टर किया जा रहा है](https://qdrant.tech/documentation/concepts/filtering/) - फ़िल्टर स्थिति
- [सूचीकरण](https://qdrant.tech/documentation/concepts/indexing/) - प्रवेश करें और निर्देशिकाओं को पूरा करें
- [क्वाडेंसाइजेशन](https://qdrant.tech/documentation/guides/quantization/) - मेमोरी अनुकूलन
- [सुरक्षा](https://qdrant.tech/documentation/guides/security/) - सत्यापन
- [मॉनीटर किया जा रहा है](https://qdrant.tech/documentation/guides/monitoring/) - अज़ाब और Telsmes
- [स्नेपशॉट](https://qdrant.tech/documentation/concepts/snapshots/) - बैकअप और पुनर्भंडारण

## क्लाएंट लाइब्रेरी

- [क्यूवर्वर .नेटटी क्लाएंट](https://github.com/qdrant/qdrant-dotnet) - आधिकारिक सी# SKK(K)
- [एनयूएपी पैकेज](https://www.nuget.org/packages/Qdrant.Client) - नवीनतम रिलीज

## संबंधित आलेख

- [एक भाग ४: ऑन- पृष्ठ (N)](/blog/semantic-search-with-onnx-and-qdrant)
- [पार्ट 5: Hybd खोज स्वचलित किया जा रहा है](/blog/rag-hybrid-search-and-indexing)
- [RAGes ओवरव्यू](/blog/rag-primer)

## स्रोत कोड

सभी कोड इस पर उपलब्ध: [gdyb.com/sek/ allyptib](https://github.com/scottgal/mostlylucidweb)

- `Mostlylucid.SemanticSearch/Services/QdrantVectorStoreService.cs` - एकीकरण