Tests.QueryDSLTests.TestFuzzQuery C# (CSharp) Method

TestFuzzQuery() private method

private TestFuzzQuery ( ) : void
return void
		public void TestFuzzQuery()
		{

			string texType = "doc_fuzzy";

			var typeSetting = new TypeSetting(texType);
			typeSetting.AddStringField("f").Analyzer = "standard";
		var op=	client.PutMapping(index, typeSetting);
			Assert.True(op.Success);
			client.Refresh();

			var doc = new IndexItem(texType,"1");
			doc.Add("f","aaaaa");
			op=client.Index(index, doc);
			Assert.True(op.Success);
			doc = new IndexItem(texType,"2");
			doc.Add("f", "aaaab");
			op = client.Index(index, doc);
			Assert.True(op.Success);
			doc = new IndexItem(texType, "3");
			doc.Add("f", "aaabb");
			op = client.Index(index, doc);
			Assert.True(op.Success);
			doc = new IndexItem(texType, "4");
			doc.Add("f", "aabbb");
			op = client.Index(index, doc);
			Assert.True(op.Success);
			doc = new IndexItem(texType, "5");
			doc.Add("f", "abbbb");
			op = client.Index(index, doc);
			Assert.True(op.Success);
			doc = new IndexItem(texType, "6");
			doc.Add("f", "bbbbb");
			op = client.Index(index, doc);
			Assert.True(op.Success);
			doc = new IndexItem(texType, "7");
			doc.Add("f", "ddddd");
			op = client.Index(index, doc);
			Assert.True(op.Success);

			client.Refresh();

			var fuzzyQ = new FuzzyQuery("f", "aaaaa");
			var result=client.Search(index, texType, fuzzyQ);
			Assert.AreEqual(3,result.GetTotalCount());
			fuzzyQ = new FuzzyQuery("f", "aaaaa");
			fuzzyQ.PrefixLength = 1;
			result = client.Search(index, texType, fuzzyQ);
			Assert.AreEqual(3, result.GetTotalCount());
			fuzzyQ = new FuzzyQuery("f", "aaaaa");
			fuzzyQ.PrefixLength = 2;
			result = client.Search(index, texType, fuzzyQ);
			Assert.AreEqual(3, result.GetTotalCount());
			fuzzyQ = new FuzzyQuery("f", "aaaaa");
			fuzzyQ.PrefixLength = 3;
			result = client.Search(index, texType, fuzzyQ);
			Assert.AreEqual(3, result.GetTotalCount());
			fuzzyQ = new FuzzyQuery("f", "aaaaa");
			fuzzyQ.PrefixLength = 4;
			result = client.Search(index, texType, fuzzyQ);
			Assert.AreEqual(2, result.GetTotalCount());
			fuzzyQ = new FuzzyQuery("f", "aaaaa");
			fuzzyQ.PrefixLength = 5;
			result = client.Search(index, texType, fuzzyQ);
			Assert.AreEqual(1, result.GetTotalCount());
			fuzzyQ = new FuzzyQuery("f", "aaaaa");
			fuzzyQ.PrefixLength = 6;
			result = client.Search(index, texType, fuzzyQ);
			Assert.AreEqual(1, result.GetTotalCount());


		}