public void TestIndexUpdate()
        {
            var tester = new LuceneCitiesFixtureData();
            Assert.Equal(1, tester.SearchFieldTerm("city", "Amsterdam").TotalHits);

            using (var indexWriter = tester.GetIndexWriter(false))
            {
                var doc = CreateDenHaagCity();
                indexWriter.UpdateDocument(new Term("id", "1"), doc);
            }
            Assert.Equal(0, tester.SearchFieldTerm("city", "Amsterdam").TotalHits);
            Assert.Equal(1, tester.SearchFieldTerm("city", "Haag").TotalHits);
        }
        public void TestMaxFieldLength()
        {
            var tester = new LuceneCitiesFixtureData();
            Assert.Equal(1, tester.SearchFieldTerm("contents", "bridges").TotalHits);

            // Create a writer with an unlimted max field length
            using (var indexWriter = tester.GetIndexWriter(false))
            {
                var doc = new Document();
                doc.Add(new Field("contents", "these bridges CAN be found (because field length is unlimited)", Field.Store.NO, Field.Index.ANALYZED));
                indexWriter.AddDocument(doc);
            }
            // Seach should now return 2 items
            Assert.Equal(2, tester.SearchFieldTerm("contents", "bridges").TotalHits);

            // Create a writer with a field length of 1 
            using (var indexWriter = tester.GetIndexWriter(false, new IndexWriter.MaxFieldLength(1)))
            {
                var doc = new Document();
                // (and a string with bridge term greater than 1)
                doc.Add(new Field("contents", "these bridges CANNOT be found (because field length is 1)", Field.Store.NO, Field.Index.ANALYZED));
                indexWriter.AddDocument(doc);
            }
            // Seach should still only return 2 items
            Assert.Equal(2, tester.SearchFieldTerm("contents", "bridges").TotalHits);
        }