Lucene.Net.Index.TestDocValuesIndexing.TestMixedTypesDifferentDocuments C# (CSharp) Method

TestMixedTypesDifferentDocuments() private method

private TestMixedTypesDifferentDocuments ( ) : void
return void
        public virtual void TestMixedTypesDifferentDocuments()
        {
            Directory dir = NewDirectory();
            IndexWriter w = new IndexWriter(dir, NewIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random())));
            Document doc = new Document();
            doc.Add(new NumericDocValuesField("foo", 0));
            w.AddDocument(doc);

            doc = new Document();
            doc.Add(new SortedDocValuesField("foo", new BytesRef("hello")));
            try
            {
                w.AddDocument(doc);
            }
            catch (System.ArgumentException iae)
            {
                // expected
            }
            w.Dispose();
            dir.Dispose();
        }