Skip to content

Commit 81af33f

Browse files
author
Justin Castilla
committed
removes commented code
1 parent ca99d4f commit 81af33f

File tree

1 file changed

+20
-169
lines changed

1 file changed

+20
-169
lines changed

supporting-blog-content/lexical-and-semantic-search-with-elasticsearch/updated-ecommerce_dense_sparse_project.ipynb

Lines changed: 20 additions & 169 deletions
Original file line numberDiff line numberDiff line change
@@ -223,20 +223,12 @@
223223
},
224224
{
225225
"cell_type": "code",
226-
"execution_count": 78,
226+
"execution_count": null,
227227
"id": "6739f55b-6983-4b48-9349-6e0111b313fe",
228228
"metadata": {
229229
"id": "6739f55b-6983-4b48-9349-6e0111b313fe"
230230
},
231-
"outputs": [
232-
{
233-
"name": "stdout",
234-
"output_type": "stream",
235-
"text": [
236-
"ecommerce-pipeline created: True\n"
237-
]
238-
}
239-
],
231+
"outputs": [],
240232
"source": [
241233
"index_pipeline = \"ecommerce-pipeline\"\n",
242234
"resp = client.ingest.put_pipeline(\n",
@@ -290,20 +282,12 @@
290282
},
291283
{
292284
"cell_type": "code",
293-
"execution_count": 82,
285+
"execution_count": null,
294286
"id": "9b53b39e-d74e-4fa8-a364-e2c3caf37418",
295287
"metadata": {
296288
"id": "9b53b39e-d74e-4fa8-a364-e2c3caf37418"
297289
},
298-
"outputs": [
299-
{
300-
"name": "stdout",
301-
"output_type": "stream",
302-
"text": [
303-
"Index ecommerce-search created: True\n"
304-
]
305-
}
306-
],
290+
"outputs": [],
307291
"source": [
308292
"# define the index name and mapping\n",
309293
"commerce_index = \"ecommerce-search\"\n",
@@ -329,10 +313,7 @@
329313
" \"type\": \"semantic_text\",\n",
330314
" \"inference_id\": e5_endpoint,\n",
331315
" },\n",
332-
" \"elser_semantic_description_vector\": {\n",
333-
" \"type\": \"semantic_text\"\n",
334-
" # \"inference_id\": elser_endpoint\n",
335-
" },\n",
316+
" \"elser_semantic_description_vector\": {\"type\": \"semantic_text\"},\n",
336317
" }\n",
337318
"}\n",
338319
"\n",
@@ -358,18 +339,10 @@
358339
},
359340
{
360341
"cell_type": "code",
361-
"execution_count": 83,
342+
"execution_count": null,
362343
"id": "c4830b74",
363344
"metadata": {},
364-
"outputs": [
365-
{
366-
"name": "stdout",
367-
"output_type": "stream",
368-
"text": [
369-
"Pipeline set for ecommerce-search: True\n"
370-
]
371-
}
372-
],
345+
"outputs": [],
373346
"source": [
374347
"resp = client.indices.put_settings(\n",
375348
" index=commerce_index,\n",
@@ -397,16 +370,7 @@
397370
"metadata": {
398371
"id": "3cfdc3b7-7e4f-4111-997b-c333ac8938ba"
399372
},
400-
"outputs": [
401-
{
402-
"name": "stdout",
403-
"output_type": "stream",
404-
"text": [
405-
"Indexing documents...\n",
406-
"Documents indexed successfully: 2506\n"
407-
]
408-
}
409-
],
373+
"outputs": [],
410374
"source": [
411375
"# Load the dataset\n",
412376
"with open(\"products-ecommerce.json\", \"r\") as f:\n",
@@ -531,28 +495,10 @@
531495
},
532496
{
533497
"cell_type": "code",
534-
"execution_count": 64,
498+
"execution_count": null,
535499
"id": "d44f3e2b",
536500
"metadata": {},
537-
"outputs": [
538-
{
539-
"name": "stdout",
540-
"output_type": "stream",
541-
"text": [
542-
"Custom Tokens: ['comfortable', 'furniture', 'for', 'a', 'large', 'balcony']\n"
543-
]
544-
},
545-
{
546-
"data": {
547-
"text/plain": [
548-
"ObjectApiResponse({'acknowledged': True})"
549-
]
550-
},
551-
"execution_count": 64,
552-
"metadata": {},
553-
"output_type": "execute_result"
554-
}
555-
],
501+
"outputs": [],
556502
"source": [
557503
"index_settings = {\n",
558504
" \"settings\": {\n",
@@ -645,31 +591,12 @@
645591
},
646592
{
647593
"cell_type": "code",
648-
"execution_count": 65,
594+
"execution_count": null,
649595
"id": "f4984f6c-ceec-46a4-b64c-f749e6b1b04f",
650596
"metadata": {
651597
"id": "f4984f6c-ceec-46a4-b64c-f749e6b1b04f"
652598
},
653-
"outputs": [
654-
{
655-
"name": "stdout",
656-
"output_type": "stream",
657-
"text": [
658-
"\n",
659-
"Score: 12.93728\n",
660-
"Product: Barbie Dreamhouse\n",
661-
"Category: Toys\n",
662-
"Description: is a classic Barbie playset with multiple rooms, furniture, a large balcony, a pool, and accessories. It allows kids to create their dream Barbie world.\n",
663-
"\n",
664-
"\n",
665-
"Score: 7.9097595\n",
666-
"Product: Rattan Patio Conversation Set\n",
667-
"Category: Outdoor Furniture\n",
668-
"Description: is a stylish and comfortable outdoor furniture set, including a sofa, two chairs, and a coffee table, all made of durable rattan material.\n",
669-
"\n"
670-
]
671-
}
672-
],
599+
"outputs": [],
673600
"source": [
674601
"results_list = []\n",
675602
"\n",
@@ -720,31 +647,12 @@
720647
},
721648
{
722649
"cell_type": "code",
723-
"execution_count": 66,
650+
"execution_count": null,
724651
"id": "72187c9a-14c1-4084-a080-4e5c1e614f22",
725652
"metadata": {
726653
"id": "72187c9a-14c1-4084-a080-4e5c1e614f22"
727654
},
728-
"outputs": [
729-
{
730-
"name": "stdout",
731-
"output_type": "stream",
732-
"text": [
733-
"\n",
734-
"Score: 0.93147576\n",
735-
"Product: Metal Garden Bench with Cushion\n",
736-
"Category: Garden Furniture\n",
737-
"Description: is a stylish and comfortable metal garden bench, complete with a cushion for added support.\n",
738-
"\n",
739-
"\n",
740-
"Score: 0.9304026\n",
741-
"Product: Garden Dining Set with Swivel Chairs\n",
742-
"Category: Garden Furniture\n",
743-
"Description: is a functional and comfortable garden dining set, including a table and chairs with swivel seats for convenience.\n",
744-
"\n"
745-
]
746-
}
747-
],
655+
"outputs": [],
748656
"source": [
749657
"# KNN\n",
750658
"# TODO: Add Semantic_Text type?\n",
@@ -782,29 +690,10 @@
782690
},
783691
{
784692
"cell_type": "code",
785-
"execution_count": 85,
693+
"execution_count": null,
786694
"id": "c5475e21",
787695
"metadata": {},
788-
"outputs": [
789-
{
790-
"name": "stdout",
791-
"output_type": "stream",
792-
"text": [
793-
"\n",
794-
"Score: 11.354144\n",
795-
"Product: Garden Lounge Set with Side Table\n",
796-
"Category: Garden Furniture\n",
797-
"Description: is a comfortable and stylish garden lounge set, including a sofa, chairs, and a side table for outdoor relaxation.\n",
798-
"\n",
799-
"\n",
800-
"Score: 11.200024\n",
801-
"Product: Garden Lounge Set with Ottoman\n",
802-
"Category: Garden Furniture\n",
803-
"Description: is a versatile and comfortable garden lounge set, including a sofa, chairs, and ottoman for outdoor relaxation.\n",
804-
"\n"
805-
]
806-
}
807-
],
696+
"outputs": [],
808697
"source": [
809698
"# Elastic Learned Sparse Encoder - ELSER\n",
810699
"\n",
@@ -837,29 +726,10 @@
837726
},
838727
{
839728
"cell_type": "code",
840-
"execution_count": 93,
729+
"execution_count": null,
841730
"id": "4d2fb926",
842731
"metadata": {},
843-
"outputs": [
844-
{
845-
"name": "stdout",
846-
"output_type": "stream",
847-
"text": [
848-
"\n",
849-
"Score: 11.354144\n",
850-
"Product: Garden Lounge Set with Side Table\n",
851-
"Category: Garden Furniture\n",
852-
"Description: is a comfortable and stylish garden lounge set, including a sofa, chairs, and a side table for outdoor relaxation.\n",
853-
"\n",
854-
"\n",
855-
"Score: 11.200024\n",
856-
"Product: Garden Lounge Set with Ottoman\n",
857-
"Category: Garden Furniture\n",
858-
"Description: is a versatile and comfortable garden lounge set, including a sofa, chairs, and ottoman for outdoor relaxation.\n",
859-
"\n"
860-
]
861-
}
862-
],
732+
"outputs": [],
863733
"source": [
864734
"# Elastic Learned Sparse Encoder - ELSER\n",
865735
"\n",
@@ -890,31 +760,12 @@
890760
},
891761
{
892762
"cell_type": "code",
893-
"execution_count": 94,
763+
"execution_count": null,
894764
"id": "2c0bf5fc-ab32-4f33-8f26-904ff10635a5",
895765
"metadata": {
896766
"id": "2c0bf5fc-ab32-4f33-8f26-904ff10635a5"
897767
},
898-
"outputs": [
899-
{
900-
"name": "stdout",
901-
"output_type": "stream",
902-
"text": [
903-
"\n",
904-
"Score: 0.93147576\n",
905-
"Product: Metal Garden Bench with Cushion\n",
906-
"Category: Garden Furniture\n",
907-
"Description: is a stylish and comfortable metal garden bench, complete with a cushion for added support.\n",
908-
"\n",
909-
"\n",
910-
"Score: 0.9304026\n",
911-
"Product: Garden Dining Set with Swivel Chairs\n",
912-
"Category: Garden Furniture\n",
913-
"Description: is a functional and comfortable garden dining set, including a table and chairs with swivel seats for convenience.\n",
914-
"\n"
915-
]
916-
}
917-
],
768+
"outputs": [],
918769
"source": [
919770
"# Elastic Learned Sparse Encoder - ELSER\n",
920771
"\n",

0 commit comments

Comments
 (0)