def test_prefix_text_chunks(self):
        """Ensures that when adding documents with a prefix, each chunk has the prefix included in the vector,
        but the actual chunk text does not have the prefix."""

        for index in [self.unstructured_index_1, self.structured_text_index]:
            with self.subTest(index=index.type):
                # A) Add normal text document (1 chunk)
                self.add_documents(config=self.config, add_docs_params=AddDocsParams(
                    index_name=index.name, docs=[{"_id": "doc_a", "text": "hello"}], auto_refresh=True,
                    tensor_fields=["text"] if isinstance(index, UnstructuredMarqoIndex) else None
                ))

                # B) Add same text document but WITH PREFIX (1 chunk)
                self.add_documents(config=self.config, add_docs_params=AddDocsParams(
                    index_name=index.name, docs=[{"_id": "doc_b", "text": "hello"}], auto_refresh=True,
                    text_chunk_prefix="PREFIX: ",
                    tensor_fields=["text"] if isinstance(index, UnstructuredMarqoIndex) else None
                ))

                # C) Add document with prefix built into text itself (1 chunk)
                self.add_documents(config=self.config, add_docs_params=AddDocsParams(
                    index_name=index.name, docs=[{"_id": "doc_c", "text": "PREFIX: hello"}], auto_refresh=True,
                    tensor_fields=["text"] if isinstance(index, UnstructuredMarqoIndex) else None
                ))

                # Get all documents (with vectors)
                res = tensor_search.get_documents_by_ids(
                    config=self.config, index_name=index.name, document_ids=["doc_a", "doc_b", "doc_c"],
                    show_vectors=True
                ).dict(exclude_none=True, by_alias=True)["results"]
                retrieved_doc_a = res[0]
                retrieved_doc_b = res[1]
                retrieved_doc_c = res[2]

                embed_res = embed(
                    marqo_config=self.config, index_name=index.name,
                    embedding_request_dict={"content": ["hello"]},
                    device="cpu"
                )

                # Chunk content: For A) and B), should be exactly the same. C) is different.
                self.assertEqual(retrieved_doc_a["text"], "hello")
                self.assertEqual(retrieved_doc_b["text"], "hello")
                self.assertEqual(retrieved_doc_c["text"], "PREFIX: hello")

                # Chunk embedding: For B) and C), should be exactly the same. A) is different.
                self.assertTrue(np.allclose(retrieved_doc_b["_tensor_facets"][0]["_embedding"],
                                            retrieved_doc_c["_tensor_facets"][0]["_embedding"]))
                self.assertFalse(np.allclose(retrieved_doc_a["_tensor_facets"][0]["_embedding"],
                                             retrieved_doc_c["_tensor_facets"][0]["_embedding"]))
                
                # embedding in document_b should be the same as direct embedding with no prefix
                self.assertTrue(np.allclose(retrieved_doc_a["_tensor_facets"][0]["_embedding"],
                                            embed_res["embeddings"][0]))
Ensures that when adding documents with a prefix, each chunk has the prefix included in the vector,
        but the actual chunk text does not have the prefix.
tests/integ_tests/tensor_search/test_prefix.py