public virtual void TestNullDocIdSet() { // Tests that if a Filter produces a null DocIdSet, which is given to // IndexSearcher, everything works fine. this came up in LUCENE-1754. Directory dir = NewDirectory(); RandomIndexWriter writer = new RandomIndexWriter( #if FEATURE_INSTANCE_TESTDATA_INITIALIZATION this, #endif Random, dir); Document doc = new Document(); doc.Add(NewStringField("c", "val", Field.Store.NO)); writer.AddDocument(doc); IndexReader reader = writer.GetReader(); writer.Dispose(); // First verify the document is searchable. IndexSearcher searcher = NewSearcher(reader); Assert.AreEqual(1, searcher.Search(new MatchAllDocsQuery(), 10).TotalHits); // Now search w/ a Filter which returns a null DocIdSet Filter f = new FilterAnonymousInnerClassHelper(this); Assert.AreEqual(0, searcher.Search(new MatchAllDocsQuery(), f, 10).TotalHits); reader.Dispose(); dir.Dispose(); }
public DocIdSetAnonymousInnerClassHelper(FilterAnonymousInnerClassHelper outerInstance, Bits acceptDocs, FunctionValues values, int maxDoc, Bits fastMatchBits) { this.outerInstance = outerInstance; this.acceptDocs = acceptDocs; this.values = values; this.maxDoc = maxDoc; this.fastMatchBits = fastMatchBits; }
public virtual void TestNullDocIdSet() { Directory dir = NewDirectory(); RandomIndexWriter writer = new RandomIndexWriter(Random(), dir, Similarity, TimeZone); writer.Dispose(); IndexReader reader = SlowCompositeReaderWrapper.Wrap(DirectoryReader.Open(dir)); AtomicReaderContext context = (AtomicReaderContext)reader.Context; Filter filter = new FilterAnonymousInnerClassHelper(this, context); CachingWrapperFilter cacher = new CachingWrapperFilter(filter); // the caching filter should return the empty set constant //Assert.IsNull(cacher.GetDocIdSet(context, "second time", (context.AtomicReader).LiveDocs)); Assert.IsNull(cacher.GetDocIdSet(context, (context.AtomicReader).LiveDocs)); reader.Dispose(); dir.Dispose(); }
public virtual void TestNullDocIdSet() { // Tests that if a Filter produces a null DocIdSet, which is given to // IndexSearcher, everything works fine. this came up in LUCENE-1754. Directory dir = NewDirectory(); RandomIndexWriter writer = new RandomIndexWriter(Random(), dir); Document doc = new Document(); doc.Add(NewStringField("c", "val", Field.Store.NO)); writer.AddDocument(doc); IndexReader reader = writer.Reader; writer.Dispose(); // First verify the document is searchable. IndexSearcher searcher = NewSearcher(reader); Assert.AreEqual(1, searcher.Search(new MatchAllDocsQuery(), 10).TotalHits); // Now search w/ a Filter which returns a null DocIdSet Filter f = new FilterAnonymousInnerClassHelper(this); Assert.AreEqual(0, searcher.Search(new MatchAllDocsQuery(), f, 10).TotalHits); reader.Dispose(); dir.Dispose(); }
public virtual void TestNullDocIdSet() { Directory dir = NewDirectory(); RandomIndexWriter writer = new RandomIndexWriter(Random(), dir); writer.Dispose(); IndexReader reader = SlowCompositeReaderWrapper.Wrap(DirectoryReader.Open(dir)); AtomicReaderContext context = (AtomicReaderContext)reader.Context; Filter filter = new FilterAnonymousInnerClassHelper(this, context); CachingWrapperFilter cacher = new CachingWrapperFilter(filter); // the caching filter should return the empty set constant //Assert.IsNull(cacher.GetDocIdSet(context, "second time", ((AtomicReader)context.Reader()).LiveDocs)); Assert.IsNull(cacher.GetDocIdSet(context, ((AtomicReader)context.Reader()).LiveDocs)); reader.Dispose(); dir.Dispose(); }