protected override void Context()
 {
     var builder = new DocumentBuilder();
     var mapping = LuceneMapper.GetMappingForType(typeof (TestObject));
     var item = new TestObject() { Id = Guid.NewGuid(), IgnoredProperty = "Property", LongId = 123456, ValidProperty = "Valid property", Text = "Abc def ghi ijkl mno pqr stuv"};
     _document = builder.BuildDocumentForMapping(item, mapping);
 }
예제 #2
0
            protected override void Context()
            {
                var dir = new SimpleFSDirectory(new DirectoryInfo(TempDirectory), new NoLockFactory());
                var analyzer = new StandardAnalyzer(Version.LUCENE_20);
                var maxFieldLength = new IndexWriter.MaxFieldLength(200);

                var index = new FluentIndexWriter<TestObject>(dir, analyzer, maxFieldLength);
                var data = new TestObject() { Id = Guid.NewGuid(), LongId = 123, ValidProperty = "Property", IgnoredProperty = "Ignored" };
                var data2 = new TestObject() { Id = Guid.Empty, LongId = 123456, ValidProperty = "Abc def ghij", IgnoredProperty = "Ignored" };

                index.AddDocument(data);
                index.AddDocument(data2);

                index.Commit();
            }