当前位置: 首页>>代码示例>>C#>>正文


C# Filter.getDocIdSet方法代码示例

本文整理汇总了C#中Filter.getDocIdSet方法的典型用法代码示例。如果您正苦于以下问题:C# Filter.getDocIdSet方法的具体用法?C# Filter.getDocIdSet怎么用?C# Filter.getDocIdSet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Filter的用法示例。


在下文中一共展示了Filter.getDocIdSet方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DocumentFilteredAtomicIndexReader

//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public DocumentFilteredAtomicIndexReader(AtomicReaderContext context, org.apache.lucene.search.Filter preserveFilter, boolean negateFilter) throws java.io.IOException
		public DocumentFilteredAtomicIndexReader(AtomicReaderContext context, Filter preserveFilter, bool negateFilter) : base(context.reader())
		{
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final int maxDoc = in.maxDoc();
		  int maxDoc = @in.maxDoc();
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.apache.lucene.util.FixedBitSet bits = new org.apache.lucene.util.FixedBitSet(maxDoc);
		  FixedBitSet bits = new FixedBitSet(maxDoc);
		  // ignore livedocs here, as we filter them later:
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.apache.lucene.search.DocIdSet docs = preserveFilter.getDocIdSet(context, null);
		  DocIdSet docs = preserveFilter.getDocIdSet(context, null);
		  if (docs != null)
		  {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.apache.lucene.search.DocIdSetIterator it = docs.iterator();
			DocIdSetIterator it = docs.GetEnumerator();
			if (it != null)
			{
			  bits.or(it);
			}
		  }
		  if (negateFilter)
		  {
			bits.flip(0, maxDoc);
		  }

		  if (@in.hasDeletions())
		  {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.apache.lucene.util.Bits oldLiveDocs = in.getLiveDocs();
			Bits oldLiveDocs = @in.LiveDocs;
			Debug.Assert(oldLiveDocs != null);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.apache.lucene.search.DocIdSetIterator it = bits.iterator();
			DocIdSetIterator it = bits.GetEnumerator();
			for (int i = it.nextDoc(); i < maxDoc; i = it.nextDoc())
			{
			  if (!oldLiveDocs.get(i))
			  {
				// we can safely modify the current bit, as the iterator already stepped over it:
				bits.clear(i);
			  }
			}
		  }

		  this.liveDocs = bits;
		  this.numDocs_Renamed = bits.cardinality();
		}
开发者ID:Cefa68000,项目名称:lucenenet,代码行数:51,代码来源:PKIndexSplitter.cs


注:本文中的Filter.getDocIdSet方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。