本文整理汇总了C#中FieldInfo.HasPayloads方法的典型用法代码示例。如果您正苦于以下问题:C# FieldInfo.HasPayloads方法的具体用法?C# FieldInfo.HasPayloads怎么用?C# FieldInfo.HasPayloads使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FieldInfo
的用法示例。
在下文中一共展示了FieldInfo.HasPayloads方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Reset
public SegmentDocsAndPositionsEnum Reset(FieldInfo fieldInfo, StandardTermState termState, Bits liveDocs)
{
Debug.Assert(fieldInfo.FieldIndexOptions == FieldInfo.IndexOptions.DOCS_AND_FREQS_AND_POSITIONS);
Debug.Assert(!fieldInfo.HasPayloads());
this.LiveDocs = liveDocs;
// TODO: for full enum case (eg segment merging) this
// seek is unnecessary; maybe we can avoid in such
// cases
FreqIn.Seek(termState.FreqOffset);
LazyProxPointer = termState.ProxOffset;
Limit = termState.DocFreq;
Debug.Assert(Limit > 0);
Ord = 0;
Doc = -1;
Accum = 0;
Position = 0;
Skipped = false;
PosPendingCount = 0;
FreqOffset = termState.FreqOffset;
ProxOffset = termState.ProxOffset;
SkipOffset = termState.SkipOffset;
// if (DEBUG) System.out.println("StandardR.D&PE reset seg=" + segment + " limit=" + limit + " freqFP=" + freqOffset + " proxFP=" + proxOffset);
return this;
}
示例2: DocsAndPositions
public override DocsAndPositionsEnum DocsAndPositions(FieldInfo fieldInfo, BlockTermState termState, Bits liveDocs, DocsAndPositionsEnum reuse, int flags)
{
bool hasOffsets = fieldInfo.FieldIndexOptions >= FieldInfo.IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS;
// TODO: can we optimize if FLAG_PAYLOADS / FLAG_OFFSETS
// isn't passed?
// TODO: refactor
if (fieldInfo.HasPayloads() || hasOffsets)
{
SegmentFullPositionsEnum docsEnum;
if (reuse == null || !(reuse is SegmentFullPositionsEnum))
{
docsEnum = new SegmentFullPositionsEnum(this, FreqIn, ProxIn);
}
else
{
docsEnum = (SegmentFullPositionsEnum)reuse;
if (docsEnum.StartFreqIn != FreqIn)
{
// If you are using ParellelReader, and pass in a
// reused DocsEnum, it could have come from another
// reader also using standard codec
docsEnum = new SegmentFullPositionsEnum(this, FreqIn, ProxIn);
}
}
return docsEnum.Reset(fieldInfo, (StandardTermState)termState, liveDocs);
}
else
{
SegmentDocsAndPositionsEnum docsEnum;
if (reuse == null || !(reuse is SegmentDocsAndPositionsEnum))
{
docsEnum = new SegmentDocsAndPositionsEnum(this, FreqIn, ProxIn);
}
else
{
docsEnum = (SegmentDocsAndPositionsEnum)reuse;
if (docsEnum.StartFreqIn != FreqIn)
{
// If you are using ParellelReader, and pass in a
// reused DocsEnum, it could have come from another
// reader also using standard codec
docsEnum = new SegmentDocsAndPositionsEnum(this, FreqIn, ProxIn);
}
}
return docsEnum.Reset(fieldInfo, (StandardTermState)termState, liveDocs);
}
}
示例3: SetField
public override int SetField(FieldInfo fieldInfo)
{
FieldInfo.IndexOptions? indexOptions = fieldInfo.FieldIndexOptions;
FieldHasFreqs = indexOptions >= FieldInfo.IndexOptions.DOCS_AND_FREQS;
FieldHasPositions = indexOptions >= FieldInfo.IndexOptions.DOCS_AND_FREQS_AND_POSITIONS;
FieldHasOffsets = indexOptions >= FieldInfo.IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS;
FieldHasPayloads = fieldInfo.HasPayloads();
SkipWriter.SetField(FieldHasPositions, FieldHasOffsets, FieldHasPayloads);
LastState = EmptyState;
if (FieldHasPositions)
{
if (FieldHasPayloads || FieldHasOffsets)
{
return 3; // doc + pos + pay FP
}
else
{
return 2; // doc + pos FP
}
}
else
{
return 1; // doc FP
}
}
示例4: PulsingDocsEnum
public PulsingDocsEnum(FieldInfo fieldInfo)
{
_indexOptions = fieldInfo.FieldIndexOptions;
_storePayloads = fieldInfo.HasPayloads();
_storeOffsets = _indexOptions.Value.CompareTo(FieldInfo.IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0;
}
示例5: CanReuse
public bool CanReuse(FieldInfo fieldInfo)
{
return _indexOptions == fieldInfo.FieldIndexOptions && _storePayloads == fieldInfo.HasPayloads();
}
示例6: SetField
/// <summary>
/// TODO: -- should we NOT reuse across fields? would
/// be cleaner
/// Currently, this instance is re-used across fields, so
/// our parent calls setField whenever the field changes
/// </summary>
/// <param name="fieldInfo"></param>
/// <returns></returns>
public override int SetField(FieldInfo fieldInfo)
{
_indexOptions = fieldInfo.FieldIndexOptions;
_storePayloads = fieldInfo.HasPayloads();
_absolute = false;
_longsSize = _wrappedPostingsWriter.SetField(fieldInfo);
_longs = new long[_longsSize];
_fields.Add(new FieldMetaData(fieldInfo.Number, _longsSize));
return 0;
}
示例7: SetField
// Currently, this instance is re-used across fields, so
// our parent calls setField whenever the field changes
public override int SetField(FieldInfo fi)
{
FIELD_INFO = fi;
if (FIELD_INFO.FieldIndexOptions.HasValue)
INDEX_OPTIONS = FIELD_INFO.FieldIndexOptions.Value;
if (INDEX_OPTIONS >= FieldInfo.IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS)
{
throw new System.NotSupportedException("this codec cannot index offsets");
}
SKIP_LIST_WRITER.IndexOptions = INDEX_OPTIONS;
STORE_PAYLOADS = INDEX_OPTIONS == FieldInfo.IndexOptions.DOCS_AND_FREQS_AND_POSITIONS &&
FIELD_INFO.HasPayloads();
LAST_PAYLOAD_FP = 0;
LAST_SKIP_FP = 0;
_lastState = SetEmptyState();
return 0;
}
示例8: Init
internal virtual SepDocsAndPositionsEnum Init(FieldInfo fieldInfo, SepTermState termState, Bits liveDocs)
{
_liveDocs = liveDocs;
_storePayloads = fieldInfo.HasPayloads();
// TODO: can't we only do this if consumer skipped consuming the previous docs?
_docIndex.CopyFrom(termState.DOC_INDEX);
_docIndex.Seek(_docReader);
_freqIndex.CopyFrom(termState.FREQ_INDEX);
_freqIndex.Seek(_freqReader);
_posIndex.CopyFrom(termState.POS_INDEX);
_posSeekPending = true;
_payloadPending = false;
_payloadFp = termState.PAYLOAD_FP;
_skipFp = termState.SKIP_FP;
_docFreq = termState.DocFreq;
_count = 0;
_doc = -1;
_accum = 0;
_pendingPosCount = 0;
_pendingPayloadBytes = 0;
_skipped = false;
return this;
}
示例9: DecodeTerm
public override void DecodeTerm(long[] empty, DataInput input, FieldInfo fieldInfo, BlockTermState bTermState,
bool absolute)
{
var termState = (SepTermState) bTermState;
termState.DOC_INDEX.Read(input, absolute);
if (fieldInfo.FieldIndexOptions != FieldInfo.IndexOptions.DOCS_ONLY)
{
termState.FREQ_INDEX.Read(input, absolute);
if (fieldInfo.FieldIndexOptions == FieldInfo.IndexOptions.DOCS_AND_FREQS_AND_POSITIONS)
{
termState.POS_INDEX.Read(input, absolute);
if (fieldInfo.HasPayloads())
{
if (absolute)
{
termState.PAYLOAD_FP = input.ReadVLong();
}
else
{
termState.PAYLOAD_FP += input.ReadVLong();
}
}
}
}
if (termState.DocFreq >= _skipMinimum)
{
if (absolute)
{
termState.SKIP_FP = input.ReadVLong();
}
else
{
termState.SKIP_FP += input.ReadVLong();
}
}
else if (absolute)
{
termState.SKIP_FP = 0;
}
}