@@ -573,96 +573,6 @@ def test_custom_vector_doc(self):
573573 assert doc_res ['_tensor_facets' ][0 ]["my_custom_vector" ] == "custom vector text"
574574 assert (np .linalg .norm (np .array (doc_res ['_tensor_facets' ][0 ]['_embedding' ])) - 1 ) < 1e-6
575575
576- def test_no_model_custom_vector_doc (self ):
577- """
578- Tests the `no_model` index model and searching with no `q` parameter.
579- Executed on documents with custom_vector field type.
580-
581- Ensures the following features work on this index:
582- 1. lexical search
583- 2. filter string search
584- 3. tensor search
585- 4. bulk search
586- 5. get document
587-
588- Note: `no_model` is not yet supported on Cloud.
589- """
590- self .test_cases = [(CloudTestIndex .unstructured_no_model , self .unstructured_no_model_index_name )]
591-
592- for cloud_test_index_to_use , open_source_test_index_name in self .test_cases :
593- test_index_name = self .get_test_index_name (
594- cloud_test_index_to_use = cloud_test_index_to_use ,
595- open_source_test_index_name = open_source_test_index_name
596- )
597-
598- DIMENSION = 512
599- custom_vector_1 = np .random .rand (DIMENSION )
600- custom_vector_1 = (custom_vector_1 / np .linalg .norm (custom_vector_1 )).tolist ()
601- custom_vector_2 = np .random .rand (DIMENSION )
602- custom_vector_2 = (custom_vector_2 / np .linalg .norm (custom_vector_2 )).tolist ()
603- custom_vector_3 = np .random .rand (DIMENSION )
604- custom_vector_3 = (custom_vector_3 / np .linalg .norm (custom_vector_3 )).tolist ()
605-
606- self .client .index (index_name = test_index_name ).add_documents (
607- documents = [
608- {
609- "my_custom_vector" : {
610- "content" : "custom vector text" ,
611- "vector" : custom_vector_1 ,
612- },
613- "_id" : "doc1" ,
614- },
615- {
616- "my_custom_vector" : {
617- "content" : "second text" ,
618- "vector" : custom_vector_2 ,
619- },
620- "_id" : "doc2" ,
621- },
622- {
623- "my_custom_vector" : {
624- "content" : "third text" ,
625- "vector" : custom_vector_3 ,
626- },
627- "_id" : "doc3" ,
628- },
629- ], mappings = {
630- "my_custom_vector" : {
631- "type" : "custom_vector"
632- }
633- },
634- tensor_fields = ["my_custom_vector" ])
635-
636- # lexical search test
637- if self .IS_MULTI_INSTANCE :
638- self .warm_request (self .client .index (test_index_name ).search ,
639- "custom vector text" , search_method = "lexical" )
640-
641- lexical_res = self .client .index (test_index_name ).search (
642- "custom vector text" , search_method = "lexical" )
643- self .assertEqual ("doc1" , lexical_res ["hits" ][0 ]["_id" ])
644-
645- # filter string test
646- if self .IS_MULTI_INSTANCE :
647- self .warm_request (self .client .index (test_index_name ).search ,
648- context = {"tensor" : [{"vector" : custom_vector_2 , "weight" : 1 }]},
649- filter_string = "my_custom_vector:(second text)" )
650-
651- filtering_res = self .client .index (test_index_name ).search (
652- context = {"tensor" : [{"vector" : custom_vector_2 , "weight" : 1 }]}, # no text query
653- filter_string = "my_custom_vector:(second text)" )
654- self .assertEqual ("doc2" , filtering_res ["hits" ][0 ]["_id" ])
655-
656- # tensor search test
657- if self .IS_MULTI_INSTANCE :
658- self .warm_request (self .client .index (test_index_name ).search ,
659- context = {"tensor" : [{"vector" : custom_vector_3 , "weight" : 1 }]})
660-
661- tensor_res = self .client .index (test_index_name ).search (
662- context = {"tensor" : [{"vector" : custom_vector_3 , "weight" : 1 }]} # no text query
663- )
664- self .assertEqual ("doc3" , tensor_res ["hits" ][0 ]["_id" ])
665-
666576 def test_add_docs_image_download_headers (self ):
667577 mock__post = mock .MagicMock ()
668578
0 commit comments