@mhalder/qdrant-mcp-server 1.1.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,18 +1,11 @@
1
- # Advanced Filtering Examples
1
+ # Advanced Filtering
2
2
 
3
- This example demonstrates powerful metadata filtering capabilities using Qdrant's filter syntax.
3
+ Master complex metadata filtering with boolean logic for powerful search refinement.
4
4
 
5
- ## What You'll Learn
6
-
7
- - Complex boolean logic (AND, OR, NOT)
8
- - Range filters for numeric values
9
- - Combining multiple filter conditions
10
- - Real-world filtering scenarios
5
+ **Time:** 20-30 minutes | **Difficulty:** Intermediate to Advanced
11
6
 
12
7
  ## Setup
13
8
 
14
- Create a collection with sample e-commerce data:
15
-
16
9
  ```
17
10
  Create a collection named "products"
18
11
 
@@ -29,117 +22,46 @@ Add these documents to products:
29
22
 
30
23
  ## Filter Examples
31
24
 
32
- ### 1. Simple Match Filter (AND)
33
-
34
- Find electronics products:
25
+ ### Basic Filters
35
26
 
36
27
  ```
28
+ # Match single category
37
29
  Search products for "device for music" with filter {"must": [{"key": "category", "match": {"value": "electronics"}}]}
38
- ```
39
-
40
- Expected: Returns p1, p4, p6 (all electronics)
30
+ # Returns: p1, p4, p6
41
31
 
42
- ### 2. Multiple Conditions (AND)
43
-
44
- Find in-stock electronics:
45
-
46
- ```
32
+ # Multiple conditions (AND)
47
33
  Search products for "gadgets" with filter {"must": [{"key": "category", "match": {"value": "electronics"}}, {"key": "in_stock", "match": {"value": true}}]}
48
- ```
49
-
50
- Expected: Returns p1, p4, p6 (in-stock electronics only)
34
+ # Returns: p1, p4, p6 (in-stock electronics)
51
35
 
52
- ### 3. OR Logic with Should
53
-
54
- Find either sports or accessories:
55
-
56
- ```
36
+ # OR logic
57
37
  Search products for "gear" with filter {"should": [{"key": "category", "match": {"value": "sports"}}, {"key": "category", "match": {"value": "accessories"}}]}
58
- ```
59
-
60
- Expected: Returns p3, p5, p7, p8 (sports OR accessories)
38
+ # Returns: p3, p5, p7, p8
61
39
 
62
- ### 4. Negation with Must Not
63
-
64
- Find everything except clothing:
65
-
66
- ```
40
+ # NOT logic
67
41
  Search products for "shopping" with filter {"must_not": [{"key": "category", "match": {"value": "clothing"}}]}
42
+ # Returns: All except p2
68
43
  ```
69
44
 
70
- Expected: Returns all products except p2
71
-
72
- ### 5. Range Filter - Greater Than
73
-
74
- **Note:** Range filters require Qdrant's range condition syntax. The current implementation supports match filters. For range queries, you would need to use Qdrant's native range syntax:
75
-
76
- Conceptual example (not yet implemented in MCP server):
77
-
78
- ```json
79
- {
80
- "must": [
81
- {
82
- "key": "price",
83
- "range": {
84
- "gt": 100.0
85
- }
86
- }
87
- ]
88
- }
89
- ```
90
-
91
- ### 6. Complex Boolean Logic
92
-
93
- Find in-stock products that are either:
94
-
95
- - Electronics with rating > 4.5, OR
96
- - Sports items under $50
45
+ ### Complex Combinations
97
46
 
98
47
  ```
48
+ # In-stock products (electronics OR sports)
99
49
  Search products for "quality products" with filter {"must": [{"key": "in_stock", "match": {"value": true}}], "should": [{"key": "category", "match": {"value": "electronics"}}, {"key": "category", "match": {"value": "sports"}}]}
100
- ```
101
-
102
- ### 7. Combining Multiple Must Conditions
103
-
104
- Find highly-rated in-stock electronics:
105
-
106
- ```
107
- Search products for "best gadgets" with filter {"must": [{"key": "category", "match": {"value": "electronics"}}, {"key": "in_stock", "match": {"value": true}}, {"key": "rating", "match": {"value": 4.5}}]}
108
- ```
109
-
110
- Note: Exact match on rating. For range queries, use Qdrant's range filter syntax.
111
-
112
- ### 8. Brand Filtering
113
50
 
114
- Find AudioTech products:
115
-
116
- ```
117
- Search products for "audio equipment" with filter {"must": [{"key": "brand", "match": {"value": "AudioTech"}}]}
118
- ```
119
-
120
- Expected: Returns p1 only
121
-
122
- ### 9. Out of Stock Products
123
-
124
- Find what needs restocking:
51
+ # Non-electronic in-stock items
52
+ Search products for "shopping" with filter {"must": [{"key": "in_stock", "match": {"value": true}}], "must_not": [{"key": "category", "match": {"value": "electronics"}}]}
53
+ # Returns: p2, p5, p8
125
54
 
126
- ```
55
+ # Out of stock items
127
56
  Search products for "items" with filter {"must": [{"key": "in_stock", "match": {"value": false}}]}
128
- ```
57
+ # Returns: p3, p7
129
58
 
130
- Expected: Returns p3, p7 (out of stock items)
131
-
132
- ### 10. Category Exclusion with Multiple Conditions
133
-
134
- Find non-electronic in-stock items:
135
-
136
- ```
137
- Search products for "shopping" with filter {"must": [{"key": "in_stock", "match": {"value": true}}], "must_not": [{"key": "category", "match": {"value": "electronics"}}]}
59
+ # Brand filtering
60
+ Search products for "audio equipment" with filter {"must": [{"key": "brand", "match": {"value": "AudioTech"}}]}
61
+ # Returns: p1 only
138
62
  ```
139
63
 
140
- Expected: Returns p2, p5, p8 (in-stock, non-electronics)
141
-
142
- ## Filter Syntax Reference
64
+ ## Filter Syntax
143
65
 
144
66
  ### Structure
145
67
 
@@ -153,24 +75,16 @@ Expected: Returns p2, p5, p8 (in-stock, non-electronics)
153
75
 
154
76
  ### Match Filter
155
77
 
156
- Exact value matching:
157
-
158
78
  ```json
159
79
  {
160
80
  "key": "field_name",
161
81
  "match": {
162
- "value": "exact_value"
82
+ "value": "exact_value" // Works with strings, numbers, booleans
163
83
  }
164
84
  }
165
85
  ```
166
86
 
167
- Works with:
168
-
169
- - Strings: `"value": "electronics"`
170
- - Numbers: `"value": 4.5`
171
- - Booleans: `"value": true`
172
-
173
- ### Range Filter (Qdrant Native)
87
+ ### Range Filters (Native Qdrant)
174
88
 
175
89
  For numeric comparisons (future enhancement):
176
90
 
@@ -188,68 +102,54 @@ For numeric comparisons (future enhancement):
188
102
 
189
103
  ## Real-World Scenarios
190
104
 
191
- ### E-commerce Product Search
192
-
193
- "Show me affordable fitness equipment"
194
-
195
105
  ```
106
+ # E-commerce: affordable fitness equipment
196
107
  Search products for "fitness equipment" with filter {"must": [{"key": "category", "match": {"value": "sports"}}, {"key": "in_stock", "match": {"value": true}}]}
197
- ```
198
-
199
- ### Inventory Management
200
108
 
201
- "Which electronics need restocking?"
202
-
203
- ```
109
+ # Inventory: electronics needing restock
204
110
  Search products for "electronics" with filter {"must": [{"key": "category", "match": {"value": "electronics"}}, {"key": "in_stock", "match": {"value": false}}]}
205
- ```
206
-
207
- ### Quality Control
208
111
 
209
- "Show me all highly-rated available products"
210
-
211
- ```
112
+ # Quality control: highly-rated available products
212
113
  Search products for "top rated products" with filter {"must": [{"key": "in_stock", "match": {"value": true}}]}
213
114
  ```
214
115
 
215
- ## Limitations and Workarounds
116
+ ## Workarounds
216
117
 
217
- ### Current Limitations
118
+ ### Price Ranges
218
119
 
219
- 1. **No native range filters**: Can't directly filter by price ranges like "between $50-$100"
220
- 2. **No text search on metadata**: Metadata matching is exact, not fuzzy
221
- 3. **No nested object queries**: Flat metadata structure only
120
+ Add `price_tier` to metadata:
222
121
 
223
- ### Workarounds
122
+ ```json
123
+ {"price_tier": "budget", "price": 29.99} // <$50
124
+ {"price_tier": "mid", "price": 149.99} // $50-$200
125
+ {"price_tier": "premium", "price": 299.99} // >$200
126
+ ```
224
127
 
225
- 1. **Price ranges**: Add price_tier to metadata:
128
+ ### Multiple Categories
226
129
 
227
- ```json
228
- {"price_tier": "budget", "price": 29.99} // budget: <$50
229
- {"price_tier": "mid", "price": 149.99} // mid: $50-$200
230
- {"price_tier": "premium", "price": 299.99} // premium: >$200
231
- ```
130
+ Use array-based tags:
232
131
 
233
- 2. **Multiple categories**: Use array-based tags:
132
+ ```json
133
+ { "tags": ["electronics", "wearable", "fitness"] }
134
+ ```
135
+
136
+ ### Date Filtering
234
137
 
235
- ```json
236
- { "tags": ["electronics", "wearable", "fitness"] }
237
- ```
138
+ Use comparable string format:
238
139
 
239
- 3. **Date filtering**: Store dates as strings in comparable format:
240
- ```json
241
- { "created_date": "2024-03-15" } // YYYY-MM-DD for lexicographic comparison
242
- ```
140
+ ```json
141
+ { "created_date": "2024-03-15" } // YYYY-MM-DD
142
+ ```
243
143
 
244
144
  ## Best Practices
245
145
 
246
- 1. **Keep metadata flat**: Avoid deep nesting for better filter performance
247
- 2. **Use consistent types**: Don't mix strings and numbers for the same field
248
- 3. **Index commonly filtered fields**: Design metadata around common queries
249
- 4. **Test filters first**: Validate filter syntax before complex queries
250
- 5. **Combine with semantic search**: Use filters to narrow, then semantic search to rank
146
+ 1. **Flat metadata** - Avoid deep nesting
147
+ 2. **Consistent types** - Don't mix strings/numbers for same field
148
+ 3. **Index common fields** - Design around frequent queries
149
+ 4. **Test filters first** - Validate syntax before complex queries
150
+ 5. **Combine with search** - Use filters to narrow, semantic search to rank
251
151
 
252
- ## Clean Up
152
+ ## Cleanup
253
153
 
254
154
  ```
255
155
  Delete collection "products"
@@ -258,5 +158,5 @@ Delete collection "products"
258
158
  ## Next Steps
259
159
 
260
160
  - Review [Qdrant filtering documentation](https://qdrant.tech/documentation/concepts/filtering/)
261
- - Explore the [Knowledge Base Example](../knowledge-base/) for organizational patterns
262
- - Check the main README for full filter syntax support
161
+ - Explore [Knowledge Base](../knowledge-base/) example for organizational patterns
162
+ - See [main README](../../README.md) for complete filter syntax reference
@@ -1,33 +1,24 @@
1
- # Knowledge Base Example
1
+ # Knowledge Base
2
2
 
3
- This example shows how to build a searchable documentation system with rich metadata for organization and filtering.
3
+ Build a searchable documentation system with rich metadata for filtering and organization.
4
+
5
+ **Time:** 15-20 minutes | **Difficulty:** Intermediate
4
6
 
5
7
  ## Use Case
6
8
 
7
- You're building a company knowledge base with:
9
+ Company knowledge base with:
8
10
 
9
11
  - Documentation from multiple teams
10
- - Articles with different topics and difficulty levels
11
- - Content that needs to be searchable and filterable
12
-
13
- ## What You'll Learn
14
-
15
- - Organizing documents with metadata
16
- - Using metadata for categorization
17
- - Filtering searches by metadata fields
18
- - Building a scalable knowledge base structure
12
+ - Content with varying topics and difficulty levels
13
+ - Searchable and filterable articles
19
14
 
20
15
  ## Setup
21
16
 
22
- ### 1. Create the Collection
23
-
24
17
  ```
18
+ # Create collection
25
19
  Create a collection named "company-kb"
26
- ```
27
-
28
- ### 2. Add Structured Documents
29
20
 
30
- ```
21
+ # Add structured documents
31
22
  Add these documents to company-kb:
32
23
  - id: "eng-001", text: "Our API uses REST principles with JSON payloads. Authentication is handled via JWT tokens in the Authorization header.", metadata: {"team": "engineering", "topic": "api", "difficulty": "intermediate", "category": "technical"}
33
24
  - id: "eng-002", text: "To deploy to production, merge your PR to main. The CI/CD pipeline automatically runs tests and deploys if all checks pass.", metadata: {"team": "engineering", "topic": "deployment", "difficulty": "beginner", "category": "process"}
@@ -39,51 +30,26 @@ Add these documents to company-kb:
39
30
 
40
31
  ## Search Examples
41
32
 
42
- ### Basic Search (No Filters)
43
-
44
33
  ```
34
+ # Basic search
45
35
  Search company-kb for "how do I deploy code"
46
- ```
47
-
48
- Expected: Returns deployment-related docs (eng-002 likely ranks highest)
49
-
50
- ### Filter by Team
51
36
 
52
- ```
37
+ # Filter by team
53
38
  Search company-kb for "process documentation" with filter {"must": [{"key": "team", "match": {"value": "engineering"}}]}
54
- ```
55
-
56
- Returns only engineering team documents.
57
39
 
58
- ### Filter by Difficulty
59
-
60
- ```
40
+ # Filter by difficulty
61
41
  Search company-kb for "getting started" with filter {"must": [{"key": "difficulty", "match": {"value": "beginner"}}]}
62
- ```
63
42
 
64
- Returns beginner-friendly documentation.
65
-
66
- ### Multiple Filters (AND)
67
-
68
- ```
43
+ # Multiple filters (AND)
69
44
  Search company-kb for "company procedures" with filter {"must": [{"key": "category", "match": {"value": "process"}}, {"key": "difficulty", "match": {"value": "beginner"}}]}
70
- ```
71
-
72
- Returns beginner process documents only.
73
45
 
74
- ### Filter by Topic
75
-
76
- ```
46
+ # Filter by topic
77
47
  Search company-kb for "pricing information" with filter {"must": [{"key": "team", "match": {"value": "sales"}}]}
78
48
  ```
79
49
 
80
- Restricts search to sales team content.
81
-
82
- ## Metadata Design Best Practices
50
+ ## Metadata Design
83
51
 
84
- ### 1. Consistent Schema
85
-
86
- Use the same metadata fields across all documents:
52
+ ### Schema Pattern
87
53
 
88
54
  ```json
89
55
  {
@@ -94,9 +60,9 @@ Use the same metadata fields across all documents:
94
60
  }
95
61
  ```
96
62
 
97
- ### 2. Hierarchical Organization
63
+ ### Advanced Patterns
98
64
 
99
- Consider nesting metadata for complex taxonomies:
65
+ **Hierarchical:**
100
66
 
101
67
  ```json
102
68
  {
@@ -107,9 +73,7 @@ Consider nesting metadata for complex taxonomies:
107
73
  }
108
74
  ```
109
75
 
110
- ### 3. Multiple Tags
111
-
112
- Use arrays for multi-category documents:
76
+ **Multi-category:**
113
77
 
114
78
  ```json
115
79
  {
@@ -118,9 +82,7 @@ Use arrays for multi-category documents:
118
82
  }
119
83
  ```
120
84
 
121
- ### 4. Timestamps and Versioning
122
-
123
- Track freshness and versions:
85
+ **Versioned:**
124
86
 
125
87
  ```json
126
88
  {
@@ -131,18 +93,7 @@ Track freshness and versions:
131
93
  }
132
94
  ```
133
95
 
134
- ## Scaling Your Knowledge Base
135
-
136
- ### Add More Content Types
137
-
138
- - Code examples with language tags
139
- - Video transcripts with duration metadata
140
- - Meeting notes with attendees and dates
141
- - Product specs with version numbers
142
-
143
- ### Implement Access Control
144
-
145
- Use metadata for permissions:
96
+ **Access Control:**
146
97
 
147
98
  ```json
148
99
  {
@@ -151,51 +102,38 @@ Use metadata for permissions:
151
102
  }
152
103
  ```
153
104
 
154
- Then filter searches based on user permissions.
105
+ ## Scaling
155
106
 
156
- ### Track Usage
107
+ ### Content Types
157
108
 
158
- Add metadata for analytics:
159
-
160
- ```json
161
- {
162
- "views": 0,
163
- "last_accessed": null,
164
- "author": "user@company.com"
165
- }
166
- ```
167
-
168
- ## Maintenance
109
+ - Code examples with language tags
110
+ - Video transcripts with duration
111
+ - Meeting notes with attendees/dates
112
+ - Product specs with versions
169
113
 
170
- ### Update Documents
114
+ ### Maintenance
171
115
 
172
- To update content, delete and re-add:
116
+ **Update documents:**
173
117
 
174
118
  ```
175
119
  Delete documents ["eng-001"] from company-kb
176
-
177
120
  Add these documents to company-kb:
178
- - id: "eng-001", text: "Updated API documentation...", metadata: {...}
121
+ - id: "eng-001", text: "Updated content...", metadata: {...}
179
122
  ```
180
123
 
181
- ### Archive Old Content
182
-
183
- Use status metadata to hide outdated docs:
124
+ **Archive old content:**
184
125
 
185
126
  ```json
186
- {
187
- "status": "archived",
188
- "archived_date": "2024-12-01"
189
- }
127
+ { "status": "archived", "archived_date": "2024-12-01" }
190
128
  ```
191
129
 
192
- Then filter searches to exclude archived content:
130
+ Then filter searches:
193
131
 
194
132
  ```
195
133
  Search company-kb for "deployment" with filter {"must_not": [{"key": "status", "match": {"value": "archived"}}]}
196
134
  ```
197
135
 
198
- ## Clean Up
136
+ ## Cleanup
199
137
 
200
138
  ```
201
139
  Delete collection "company-kb"
@@ -203,5 +141,5 @@ Delete collection "company-kb"
203
141
 
204
142
  ## Next Steps
205
143
 
206
- - [Advanced Filtering Examples](../filters/) - Learn complex filter patterns
207
- - See the main README for information on batch document operations
144
+ - Explore [Advanced Filtering](../filters/) for complex filter patterns
145
+ - Review [main README](../../README.md) for batch operations and advanced features