本文整理汇总了C#中Lucene.Net.Index.FieldInfo.HasPayloads方法的典型用法代码示例。如果您正苦于以下问题:C# FieldInfo.HasPayloads方法的具体用法?C# FieldInfo.HasPayloads怎么用?C# FieldInfo.HasPayloads使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Lucene.Net.Index.FieldInfo
的用法示例。
在下文中一共展示了FieldInfo.HasPayloads方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PulsingDocsAndPositionsEnum
public PulsingDocsAndPositionsEnum(FieldInfo fieldInfo)
{
indexOptions = fieldInfo.IndexOptions;
storePayloads = fieldInfo.HasPayloads();
storeOffsets =
indexOptions.Value.CompareTo(FieldInfo.IndexOptions_e.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0;
}
示例2: CanReuse
public bool CanReuse(FieldInfo fieldInfo)
{
return indexOptions == fieldInfo.IndexOptions && storePayloads == fieldInfo.HasPayloads();
}
示例3: CanReuse
public bool CanReuse(IndexInput docIn, FieldInfo fieldInfo)
{
return docIn == StartDocIn && IndexHasFreq == (fieldInfo.FieldIndexOptions >= FieldInfo.IndexOptions.DOCS_AND_FREQS) && IndexHasPos == (fieldInfo.FieldIndexOptions >= FieldInfo.IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) && IndexHasPayloads == fieldInfo.HasPayloads();
}
示例4: 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)
{
this.indexOptions = fieldInfo.IndexOptions;
storePayloads = fieldInfo.HasPayloads();
absolute = false;
longsSize = _wrappedPostingsWriter.SetField(fieldInfo);
longs = new long[longsSize];
fields.Add(new FieldMetaData(fieldInfo.Number, longsSize));
return 0;
}
示例5: BlockDocsEnum
public BlockDocsEnum(Lucene41PostingsReader outerInstance, FieldInfo fieldInfo)
{
this.OuterInstance = outerInstance;
this.StartDocIn = outerInstance.DocIn;
this.DocIn = null;
IndexHasFreq = fieldInfo.FieldIndexOptions >= FieldInfo.IndexOptions.DOCS_AND_FREQS;
IndexHasPos = fieldInfo.FieldIndexOptions >= FieldInfo.IndexOptions.DOCS_AND_FREQS_AND_POSITIONS;
IndexHasOffsets = fieldInfo.FieldIndexOptions >= FieldInfo.IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS;
IndexHasPayloads = fieldInfo.HasPayloads();
Encoded = new byte[ForUtil.MAX_ENCODED_SIZE];
}
示例6: _decodeTerm
private void _decodeTerm(DataInput @in, FieldInfo fieldInfo, Lucene41PostingsWriter.IntBlockTermState termState)
{
bool fieldHasPositions = fieldInfo.FieldIndexOptions >= FieldInfo.IndexOptions.DOCS_AND_FREQS_AND_POSITIONS;
bool fieldHasOffsets = fieldInfo.FieldIndexOptions >= FieldInfo.IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS;
bool fieldHasPayloads = fieldInfo.HasPayloads();
if (termState.DocFreq == 1)
{
termState.SingletonDocID = @in.ReadVInt();
}
else
{
termState.SingletonDocID = -1;
termState.DocStartFP += @in.ReadVLong();
}
if (fieldHasPositions)
{
termState.PosStartFP += @in.ReadVLong();
if (termState.TotalTermFreq > Lucene41PostingsFormat.BLOCK_SIZE)
{
termState.LastPosBlockOffset = @in.ReadVLong();
}
else
{
termState.LastPosBlockOffset = -1;
}
if ((fieldHasPayloads || fieldHasOffsets) && termState.TotalTermFreq >= Lucene41PostingsFormat.BLOCK_SIZE)
{
termState.PayStartFP += @in.ReadVLong();
}
}
if (termState.DocFreq > Lucene41PostingsFormat.BLOCK_SIZE)
{
termState.SkipOffset = @in.ReadVLong();
}
else
{
termState.SkipOffset = -1;
}
}
示例7: DocsAndPositions
// TODO: specialize to liveDocs vs not
public override DocsAndPositionsEnum DocsAndPositions(FieldInfo fieldInfo, BlockTermState termState, Bits liveDocs, DocsAndPositionsEnum reuse, int flags)
{
bool indexHasOffsets = fieldInfo.FieldIndexOptions >= FieldInfo.IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS;
bool indexHasPayloads = fieldInfo.HasPayloads();
if ((!indexHasOffsets || (flags & DocsAndPositionsEnum.FLAG_OFFSETS) == 0) && (!indexHasPayloads || (flags & DocsAndPositionsEnum.FLAG_PAYLOADS) == 0))
{
BlockDocsAndPositionsEnum docsAndPositionsEnum;
if (reuse is BlockDocsAndPositionsEnum)
{
docsAndPositionsEnum = (BlockDocsAndPositionsEnum)reuse;
if (!docsAndPositionsEnum.CanReuse(DocIn, fieldInfo))
{
docsAndPositionsEnum = new BlockDocsAndPositionsEnum(this, fieldInfo);
}
}
else
{
docsAndPositionsEnum = new BlockDocsAndPositionsEnum(this, fieldInfo);
}
return docsAndPositionsEnum.Reset(liveDocs, (Lucene41PostingsWriter.IntBlockTermState)termState);
}
else
{
EverythingEnum everythingEnum;
if (reuse is EverythingEnum)
{
everythingEnum = (EverythingEnum)reuse;
if (!everythingEnum.CanReuse(DocIn, fieldInfo))
{
everythingEnum = new EverythingEnum(this, fieldInfo);
}
}
else
{
everythingEnum = new EverythingEnum(this, fieldInfo);
}
return everythingEnum.Reset(liveDocs, (Lucene41PostingsWriter.IntBlockTermState)termState, flags);
}
}
示例8: EverythingEnum
public EverythingEnum(Lucene41PostingsReader outerInstance, FieldInfo fieldInfo)
{
this.OuterInstance = outerInstance;
this.StartDocIn = outerInstance.DocIn;
this.DocIn = null;
this.PosIn = (IndexInput)outerInstance.PosIn.Clone();
this.PayIn = (IndexInput)outerInstance.PayIn.Clone();
Encoded = new byte[ForUtil.MAX_ENCODED_SIZE];
IndexHasOffsets = fieldInfo.FieldIndexOptions >= FieldInfo.IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS;
if (IndexHasOffsets)
{
OffsetStartDeltaBuffer = new int[ForUtil.MAX_DATA_SIZE];
OffsetLengthBuffer = new int[ForUtil.MAX_DATA_SIZE];
}
else
{
OffsetStartDeltaBuffer = null;
OffsetLengthBuffer = null;
StartOffset_Renamed = -1;
EndOffset_Renamed = -1;
}
IndexHasPayloads = fieldInfo.HasPayloads();
if (IndexHasPayloads)
{
PayloadLengthBuffer = new int[ForUtil.MAX_DATA_SIZE];
PayloadBytes = new byte[128];
Payload_Renamed = new BytesRef();
}
else
{
PayloadLengthBuffer = null;
PayloadBytes = null;
Payload_Renamed = null;
}
}
示例9: DecodeTerm
public override void DecodeTerm(long[] longs, DataInput @in, FieldInfo fieldInfo, BlockTermState _termState, bool absolute)
{
Lucene41PostingsWriter.IntBlockTermState termState = (Lucene41PostingsWriter.IntBlockTermState)_termState;
bool fieldHasPositions = fieldInfo.FieldIndexOptions >= FieldInfo.IndexOptions.DOCS_AND_FREQS_AND_POSITIONS;
bool fieldHasOffsets = fieldInfo.FieldIndexOptions >= FieldInfo.IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS;
bool fieldHasPayloads = fieldInfo.HasPayloads();
if (absolute)
{
termState.DocStartFP = 0;
termState.PosStartFP = 0;
termState.PayStartFP = 0;
}
if (Version < Lucene41PostingsWriter.VERSION_META_ARRAY) // backward compatibility
{
_decodeTerm(@in, fieldInfo, termState);
return;
}
termState.DocStartFP += longs[0];
if (fieldHasPositions)
{
termState.PosStartFP += longs[1];
if (fieldHasOffsets || fieldHasPayloads)
{
termState.PayStartFP += longs[2];
}
}
if (termState.DocFreq == 1)
{
termState.SingletonDocID = @in.ReadVInt();
}
else
{
termState.SingletonDocID = -1;
}
if (fieldHasPositions)
{
if (termState.TotalTermFreq > Lucene41PostingsFormat.BLOCK_SIZE)
{
termState.LastPosBlockOffset = @in.ReadVLong();
}
else
{
termState.LastPosBlockOffset = -1;
}
}
if (termState.DocFreq > Lucene41PostingsFormat.BLOCK_SIZE)
{
termState.SkipOffset = @in.ReadVLong();
}
else
{
termState.SkipOffset = -1;
}
}