You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: notebooks/01_getting_started.ipynb
+11-3Lines changed: 11 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -19,7 +19,7 @@
19
19
"\n",
20
20
"Prerequisites:\n",
21
21
"- Ensure `RedisVL` is installed in your Java environment.\n",
22
-
"- Have a running instance of [Redis Stack](https://redis.io/docs/install/install-stack/) or [Redis Cloud](https://redis.io/cloud).\n",
22
+
"- Have a running instance of [Redis Stack](https://redis.io/docs/latest/operate/oss_and_stack/install/install-stack/) or [Redis Cloud](https://redis.io/cloud).\n",
"source": "# Advanced Query Types\n\nIn this notebook, we will explore advanced query types available in RedisVL:\n\n1. **`TextQuery`**: Full text search with advanced scoring\n2. **`AggregateHybridQuery`**: Combines text and vector search for hybrid retrieval\n3. **`MultiVectorQuery`**: Search over multiple vector fields simultaneously\n\nThese query types are powerful tools for building sophisticated search applications that go beyond simple vector similarity search.\n\nPrerequisites:\n- Ensure RedisVL4J is available in your Java environment.\n- Have a running instance of [Redis Stack](https://redis.io/docs/install/install-stack/) or [Redis Cloud](https://redis.io/cloud)."
7
+
"source": [
8
+
"# Advanced Query Types\n",
9
+
"\n",
10
+
"In this notebook, we will explore advanced query types available in RedisVL:\n",
11
+
"\n",
12
+
"1. **`TextQuery`**: Full text search with advanced scoring\n",
13
+
"2. **`AggregateHybridQuery`**: Combines text and vector search for hybrid retrieval\n",
14
+
"3. **`MultiVectorQuery`**: Search over multiple vector fields simultaneously\n",
15
+
"\n",
16
+
"These query types are powerful tools for building sophisticated search applications that go beyond simple vector similarity search.\n",
17
+
"\n",
18
+
"Prerequisites:\n",
19
+
"- Ensure RedisVL4J is available in your Java environment.\n",
20
+
"- Have a running instance of [Redis Stack](https://redis.io/docs/latest/operate/oss_and_stack/install/install-stack/) or [Redis Cloud](https://redis.io/cloud)."
21
+
]
8
22
},
9
23
{
10
24
"cell_type": "markdown",
@@ -423,69 +437,179 @@
423
437
"cell_type": "markdown",
424
438
"id": "hybrid-query-intro",
425
439
"metadata": {},
426
-
"source": "## 2. AggregateHybridQuery: Combining Text and Vector Search\n\nThe `AggregateHybridQuery` combines text search and vector similarity to provide the best of both worlds:\n- **Text search**: Finds exact keyword matches\n- **Vector search**: Captures semantic similarity\n\nResults are scored using a weighted combination:\n\n```\nhybrid_score = (alpha) * vector_score + (1 - alpha) * text_score\n```\n\nWhere `alpha` controls the balance between vector and text search (default: 0.7)."
440
+
"source": [
441
+
"## 2. AggregateHybridQuery: Combining Text and Vector Search\n",
442
+
"\n",
443
+
"The `AggregateHybridQuery` combines text search and vector similarity to provide the best of both worlds:\n",
"source": "### Adjusting the Alpha Parameter\n\nThe `alpha` parameter controls the weight between vector and text search:\n- `alpha=1.0`: Pure vector search\n- `alpha=0.0`: Pure text search\n- `alpha=0.7` (default): 70% vector, 30% text"
494
+
"source": [
495
+
"### Adjusting the Alpha Parameter\n",
496
+
"\n",
497
+
"The `alpha` parameter controls the weight between vector and text search:\n",
"source": "## 3. MultiVectorQuery: Multi-Vector Search\n\nThe `MultiVectorQuery` allows you to search over multiple vector fields simultaneously. This is useful when you have different types of embeddings (e.g., text and image embeddings) and want to find results that match across multiple modalities.\n\nThe final score is calculated as a weighted combination:\n\n```\ncombined_score = w_1 * score_1 + w_2 * score_2 + w_3 * score_3 + ...\n```"
602
+
"source": [
603
+
"## 3. MultiVectorQuery: Multi-Vector Search\n",
604
+
"\n",
605
+
"The `MultiVectorQuery` allows you to search over multiple vector fields simultaneously. This is useful when you have different types of embeddings (e.g., text and image embeddings) and want to find results that match across multiple modalities.\n",
606
+
"\n",
607
+
"The final score is calculated as a weighted combination:\n",
"source": "## Best Practices\n\n### When to Use Each Query Type:\n\n1. **`TextQuery`**:\n - When you need precise keyword matching\n - For traditional search engine functionality\n - When text relevance scoring is important\n - Example: Product search, document retrieval\n\n2. **`AggregateHybridQuery`**:\n - When you want to combine keyword and semantic search\n - For improved search quality over pure text or vector search\n - When you have both text and vector representations of your data\n - Example: E-commerce search, content recommendation\n\n3. **`MultiVectorQuery`**:\n - When you have multiple types of embeddings (text, image, audio, etc.)\n - For multi-modal search applications\n - When you want to balance multiple semantic signals\n - Example: Image-text search, cross-modal retrieval"
815
+
"source": [
816
+
"## Best Practices\n",
817
+
"\n",
818
+
"### When to Use Each Query Type:\n",
819
+
"\n",
820
+
"1. **`TextQuery`**:\n",
821
+
" - When you need precise keyword matching\n",
822
+
" - For traditional search engine functionality\n",
0 commit comments