本文整理汇总了C#中Lucene.Net.Index.AtomicReader类的典型用法代码示例。如果您正苦于以下问题:C# AtomicReader类的具体用法?C# AtomicReader怎么用?C# AtomicReader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AtomicReader类属于Lucene.Net.Index命名空间,在下文中一共展示了AtomicReader类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AtomicReaderContext
/// <summary>
/// Creates a new <seealso cref="AtomicReaderContext"/>
/// </summary>
internal AtomicReaderContext(CompositeReaderContext parent, AtomicReader reader, int ord, int docBase, int leafOrd, int leafDocBase)
: base(parent, ord, docBase)
{
this.Ord = leafOrd;
this.DocBase = leafDocBase;
this.reader = reader;
this.leaves = IsTopLevel ? new[] { this } : null; //LUCENE TO-DO suspicous
}
示例2: StandardDirectoryReader
/// <summary>
/// called only from static open() methods </summary>
internal StandardDirectoryReader(Directory directory, AtomicReader[] readers, IndexWriter writer, SegmentInfos sis, int termInfosIndexDivisor, bool applyAllDeletes)
: base(directory, readers)
{
this.Writer = writer;
this.SegmentInfos = sis;
this.TermInfosIndexDivisor = termInfosIndexDivisor;
this.ApplyAllDeletes = applyAllDeletes;
}
示例3: Unwrap
/// <summary>
/// Get the wrapped instance by <code>reader</code> as long as this reader is
/// an intance of <seealso cref="FilterAtomicReader"/>.
/// </summary>
public static AtomicReader Unwrap(AtomicReader reader)
{
while (reader is FilterAtomicReader)
{
reader = ((FilterAtomicReader)reader)[email protected];
}
return reader;
}
示例4: AssertingAtomicReader
public AssertingAtomicReader(AtomicReader @in)
: base(@in)
{
// check some basic reader sanity
Debug.Assert(@in.MaxDoc >= 0);
Debug.Assert(@in.NumDocs <= @in.MaxDoc);
Debug.Assert(@in.NumDeletedDocs + @in.NumDocs == @in.MaxDoc);
Debug.Assert([email protected] || @in.NumDeletedDocs > 0 && @in.NumDocs < @in.MaxDoc);
}
示例5: AssertingAtomicReader
public AssertingAtomicReader(AtomicReader @in)
: base(@in)
{
// check some basic reader sanity
Debug.Assert(@in.MaxDoc() >= 0);
Debug.Assert(@in.NumDocs() <= @in.MaxDoc());
Debug.Assert(@in.NumDeletedDocs() + @in.NumDocs() == @in.MaxDoc());
Debug.Assert([email protected]() || @in.NumDeletedDocs() > 0 && @in.NumDocs() < @in.MaxDoc());
}
示例6: CachedDistanceFunctionValue
public CachedDistanceFunctionValue(AtomicReader reader, ShapeFieldCacheDistanceValueSource enclosingInstance)
{
cache = enclosingInstance.provider.GetCache(reader);
this.enclosingInstance = enclosingInstance;
from = enclosingInstance.from;
calculator = enclosingInstance.ctx.GetDistCalc();
nullValue = (enclosingInstance.ctx.IsGeo() ? 180 : double.MaxValue);
}
示例7: Warm
public override void Warm(AtomicReader reader)
{
long startTime = DateTime.Now.Millisecond;
int indexedCount = 0;
int docValuesCount = 0;
int normsCount = 0;
foreach (FieldInfo info in reader.FieldInfos)
{
if (info.Indexed)
{
reader.Terms(info.Name);
indexedCount++;
if (info.HasNorms())
{
reader.GetNormValues(info.Name);
normsCount++;
}
}
if (info.HasDocValues())
{
switch (info.DocValuesType)
{
case DocValuesType_e.NUMERIC:
reader.GetNumericDocValues(info.Name);
break;
case DocValuesType_e.BINARY:
reader.GetBinaryDocValues(info.Name);
break;
case DocValuesType_e.SORTED:
reader.GetSortedDocValues(info.Name);
break;
case DocValuesType_e.SORTED_SET:
reader.GetSortedSetDocValues(info.Name);
break;
default:
Debug.Assert(false); // unknown dv type
break;
}
docValuesCount++;
}
}
reader.Document(0);
reader.GetTermVectors(0);
if (InfoStream.IsEnabled("SMSW"))
{
InfoStream.Message("SMSW", "Finished warming segment: " + reader + ", indexed=" + indexedCount + ", docValues=" + docValuesCount + ", norms=" + normsCount + ", time=" + (DateTime.Now.Millisecond - startTime));
}
}
示例8: Build
/// <summary>
/// Creates a <seealso cref="DocMap"/> instance appropriate for
/// this reader.
/// </summary>
public static DocMap Build(AtomicReader reader)
{
int maxDoc = reader.MaxDoc();
if (!reader.HasDeletions())
{
return new NoDelDocMap(maxDoc);
}
Bits liveDocs = reader.LiveDocs;
return Build(maxDoc, liveDocs);
}
示例9: GetDocsAndPositions
public virtual DocsAndPositionsEnum GetDocsAndPositions(AtomicReader reader, BytesRef bytes, Bits liveDocs)
{
Terms terms = reader.Terms(FieldName);
if (terms != null)
{
TermsEnum te = terms.Iterator(null);
if (te.SeekExact(bytes))
{
return te.DocsAndPositions(liveDocs, null);
}
}
return null;
}
示例10: DistanceFunctionValue
public DistanceFunctionValue(DistanceValueSource outerInstance, AtomicReader reader)
{
this.outerInstance = outerInstance;
ptX = FieldCache.DEFAULT.GetDoubles(reader, outerInstance.strategy.FieldNameX, true);
ptY = FieldCache.DEFAULT.GetDoubles(reader, outerInstance.strategy.FieldNameY, true);
validX = FieldCache.DEFAULT.GetDocsWithField(reader, outerInstance.strategy.FieldNameX);
validY = FieldCache.DEFAULT.GetDocsWithField(reader, outerInstance.strategy.FieldNameY);
from = outerInstance.from;
calculator = outerInstance.strategy.SpatialContext.DistCalc;
nullValue = (outerInstance.strategy.SpatialContext.IsGeo ? 180 * outerInstance.multiplier : double.MaxValue);
}
示例11: DistanceFunctionValue
public DistanceFunctionValue(DistanceValueSource enclosingInstance, AtomicReader reader)
{
this.enclosingInstance = enclosingInstance;
ptX = FieldCache.DEFAULT.GetDoubles(reader, enclosingInstance.strategy.FieldNameX, true);
ptY = FieldCache.DEFAULT.GetDoubles(reader, enclosingInstance.strategy.FieldNameY, true);
validX = FieldCache.DEFAULT.GetDocsWithField(reader, enclosingInstance.strategy.FieldNameX);
validY = FieldCache.DEFAULT.GetDocsWithField(reader, enclosingInstance.strategy.FieldNameY);
from = enclosingInstance.from;
calculator = enclosingInstance.strategy.SpatialContext.GetDistCalc();
nullValue = (enclosingInstance.strategy.SpatialContext.IsGeo() ? 180 : double.MaxValue);
}
示例12: BBoxSimilarityValueSourceFunctionValue
public BBoxSimilarityValueSourceFunctionValue(AtomicReader reader,
BBoxSimilarityValueSource enclosingInstance)
{
_enclosingInstance = enclosingInstance;
rect = _enclosingInstance.strategy.SpatialContext.MakeRectangle(0, 0, 0, 0); //reused
minX = FieldCache.DEFAULT.GetDoubles(reader, enclosingInstance.strategy.field_minX, true);
minY = FieldCache.DEFAULT.GetDoubles(reader, enclosingInstance.strategy.field_minY, true);
maxX = FieldCache.DEFAULT.GetDoubles(reader, enclosingInstance.strategy.field_maxX, true);
maxY = FieldCache.DEFAULT.GetDoubles(reader, enclosingInstance.strategy.field_maxY, true);
validMinX = FieldCache.DEFAULT.GetDocsWithField(reader, enclosingInstance.strategy.field_minX);
validMaxX = FieldCache.DEFAULT.GetDocsWithField(reader, enclosingInstance.strategy.field_maxX);
}
示例13: CorrectBits
private FixedBitSet CorrectBits(AtomicReader reader, Bits acceptDocs)
{
FixedBitSet bits = new FixedBitSet(reader.MaxDoc); //assume all are INvalid
Terms terms = reader.Fields.Terms(fieldName);
if (terms == null)
{
return bits;
}
TermsEnum termsEnum = terms.Iterator(null);
DocsEnum docs = null;
while (true)
{
BytesRef currTerm = termsEnum.Next();
if (currTerm == null)
{
break;
}
else
{
docs = termsEnum.Docs(acceptDocs, docs, DocsEnum.FLAG_NONE);
int doc = docs.NextDoc();
if (doc != DocIdSetIterator.NO_MORE_DOCS)
{
if (keepMode == KeepMode.KM_USE_FIRST_OCCURRENCE)
{
bits.Set(doc);
}
else
{
int lastDoc = doc;
while (true)
{
lastDoc = doc;
doc = docs.NextDoc();
if (doc == DocIdSetIterator.NO_MORE_DOCS)
{
break;
}
}
bits.Set(lastDoc);
}
}
}
}
return bits;
}
示例14: CheckNorms
public static void CheckNorms(AtomicReader reader)
{
// test omit norms
for (int i = 0; i < DocHelper.Fields.Length; i++)
{
IndexableField f = DocHelper.Fields[i];
if (f.FieldType().Indexed)
{
Assert.AreEqual(reader.GetNormValues(f.Name()) != null, !f.FieldType().OmitNorms);
Assert.AreEqual(reader.GetNormValues(f.Name()) != null, !DocHelper.NoNorms.ContainsKey(f.Name()));
if (reader.GetNormValues(f.Name()) == null)
{
// test for norms of null
NumericDocValues norms = MultiDocValues.GetNormValues(reader, f.Name());
Assert.IsNull(norms);
}
}
}
}
示例15: DocIdSetToCache
protected override DocIdSet DocIdSetToCache(DocIdSet docIdSet, AtomicReader reader)
{
if (docIdSet == null)
{
return EMPTY_DOCIDSET;
}
if (docIdSet is FixedBitSet)
{
// this is different from CachingWrapperFilter: even when the DocIdSet is
// cacheable, we convert it to a FixedBitSet since we require all the
// cached filters to be FixedBitSets
return docIdSet;
}
DocIdSetIterator it = docIdSet.GetIterator();
if (it == null)
{
return EMPTY_DOCIDSET;
}
FixedBitSet copy = new FixedBitSet(reader.MaxDoc);
copy.Or(it);
return copy;
}