diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Query/HybridRankingQueryTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Query/HybridRankingQueryTests.cs index f07b8f3dcf..5e8137044d 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Query/HybridRankingQueryTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Query/HybridRankingQueryTests.cs @@ -14,14 +14,6 @@ public class HybridRankingQueryTests { private CosmosClient CreateCosmosClient(bool local) { - return local ? - new CosmosClient( - "https://localhost:8081", - "") : - new CosmosClient( - "https://hybridranktest.documents.azure.com:443/", - "", - new CosmosClientOptions() { ConnectionMode = ConnectionMode.Gateway }); } [TestMethod] @@ -69,6 +61,32 @@ await databaseForVectorEmbedding.DefineContainer(containerName, partitionKeyPath Assert.AreEqual(fullTextPath1, containerSettings.IndexingPolicy.FullTextIndexes[0].Path); } + [TestMethod] + public async Task CreatePolicyAndIdnexOnExistingContainer() + { + string path = "/abstract"; + CosmosClient client = this.CreateCosmosClient(local: false); + Container container = client.GetContainer("HybridRankTesting", "arxiv-250kdocuments-index"); + ContainerResponse response = await container.ReadContainerAsync(); + ContainerProperties containerProperties = response.Resource; + containerProperties.FullTextPolicy = new FullTextPolicy + { + DefaultLanguage = "en-US", + FullTextPaths = new Collection + { + new FullTextPath + { + Path = path, + Language = "en-US", + } + } + }; + containerProperties.IndexingPolicy.FullTextIndexes.Add(new FullTextIndexPath { Path = path }); + + ContainerResponse containerResponse = await container.ReplaceContainerAsync(containerProperties); + Assert.IsTrue(containerResponse.StatusCode == HttpStatusCode.OK); + } + [TestMethod] public async Task CreateCollectionBothPolicyAndIndex() {