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


Java FieldInfo.hasPayloads方法代码示例

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


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

示例1: seek

import org.apache.lucene.index.FieldInfo; //导入方法依赖的package包/类
void seek(TermInfo ti, Term term) throws IOException {
  count = 0;
  FieldInfo fi = fieldInfos.fieldInfo(term.field());
  this.indexOptions = (fi != null) ? fi.getIndexOptions() : IndexOptions.DOCS_AND_FREQS_AND_POSITIONS;
  currentFieldStoresPayloads = (fi != null) ? fi.hasPayloads() : false;
  if (ti == null) {
    df = 0;
  } else {
    df = ti.docFreq;
    doc = 0;
    freqBasePointer = ti.freqPointer;
    proxBasePointer = ti.proxPointer;
    skipPointer = freqBasePointer + ti.skipOffset;
    freqStream.seek(freqBasePointer);
    haveSkipped = false;
  }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:18,代码来源:SegmentTermDocs.java

示例2: setField

import org.apache.lucene.index.FieldInfo; //导入方法依赖的package包/类
@Override
public int setField(FieldInfo fieldInfo) {
  IndexOptions indexOptions = fieldInfo.getIndexOptions();
  fieldHasFreqs = indexOptions.compareTo(IndexOptions.DOCS_AND_FREQS) >= 0;
  fieldHasPositions = indexOptions.compareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0;
  fieldHasOffsets = indexOptions.compareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0;
  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
  }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:20,代码来源:Lucene41PostingsWriter.java

示例3: _decodeTerm

import org.apache.lucene.index.FieldInfo; //导入方法依赖的package包/类
private void _decodeTerm(DataInput in, FieldInfo fieldInfo, IntBlockTermState termState) throws IOException {
  final boolean fieldHasPositions = fieldInfo.getIndexOptions().compareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0;
  final boolean fieldHasOffsets = fieldInfo.getIndexOptions().compareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0;
  final boolean 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 > BLOCK_SIZE) {
      termState.lastPosBlockOffset = in.readVLong();
    } else {
      termState.lastPosBlockOffset = -1;
    }
    if ((fieldHasPayloads || fieldHasOffsets) && termState.totalTermFreq >= BLOCK_SIZE) {
      termState.payStartFP += in.readVLong();
    }
  }
  if (termState.docFreq > BLOCK_SIZE) {
    termState.skipOffset = in.readVLong();
  } else {
    termState.skipOffset = -1;
  }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:28,代码来源:Lucene41PostingsReader.java

示例4: docsAndPositions

import org.apache.lucene.index.FieldInfo; //导入方法依赖的package包/类
@Override
public DocsAndPositionsEnum docsAndPositions(FieldInfo fieldInfo, BlockTermState termState, Bits liveDocs,
                                             DocsAndPositionsEnum reuse, int flags)
  throws IOException {

  boolean indexHasOffsets = fieldInfo.getIndexOptions().compareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0;
  boolean indexHasPayloads = fieldInfo.hasPayloads();

  if ((!indexHasOffsets || (flags & DocsAndPositionsEnum.FLAG_OFFSETS) == 0) &&
      (!indexHasPayloads || (flags & DocsAndPositionsEnum.FLAG_PAYLOADS) == 0)) {
    BlockDocsAndPositionsEnum docsAndPositionsEnum;
    if (reuse instanceof BlockDocsAndPositionsEnum) {
      docsAndPositionsEnum = (BlockDocsAndPositionsEnum) reuse;
      if (!docsAndPositionsEnum.canReuse(docIn, fieldInfo)) {
        docsAndPositionsEnum = new BlockDocsAndPositionsEnum(fieldInfo);
      }
    } else {
      docsAndPositionsEnum = new BlockDocsAndPositionsEnum(fieldInfo);
    }
    return docsAndPositionsEnum.reset(liveDocs, (IntBlockTermState) termState);
  } else {
    EverythingEnum everythingEnum;
    if (reuse instanceof EverythingEnum) {
      everythingEnum = (EverythingEnum) reuse;
      if (!everythingEnum.canReuse(docIn, fieldInfo)) {
        everythingEnum = new EverythingEnum(fieldInfo);
      }
    } else {
      everythingEnum = new EverythingEnum(fieldInfo);
    }
    return everythingEnum.reset(liveDocs, (IntBlockTermState) termState, flags);
  }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:34,代码来源:Lucene41PostingsReader.java

示例5: BlockDocsEnum

import org.apache.lucene.index.FieldInfo; //导入方法依赖的package包/类
public BlockDocsEnum(FieldInfo fieldInfo) throws IOException {
  this.startDocIn = Lucene41PostingsReader.this.docIn;
  this.docIn = null;
  indexHasFreq = fieldInfo.getIndexOptions().compareTo(IndexOptions.DOCS_AND_FREQS) >= 0;
  indexHasPos = fieldInfo.getIndexOptions().compareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0;
  indexHasOffsets = fieldInfo.getIndexOptions().compareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0;
  indexHasPayloads = fieldInfo.hasPayloads();
  encoded = new byte[MAX_ENCODED_SIZE];    
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:10,代码来源:Lucene41PostingsReader.java

示例6: BlockDocsAndPositionsEnum

import org.apache.lucene.index.FieldInfo; //导入方法依赖的package包/类
public BlockDocsAndPositionsEnum(FieldInfo fieldInfo) throws IOException {
  this.startDocIn = Lucene41PostingsReader.this.docIn;
  this.docIn = null;
  this.posIn = Lucene41PostingsReader.this.posIn.clone();
  encoded = new byte[MAX_ENCODED_SIZE];
  indexHasOffsets = fieldInfo.getIndexOptions().compareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0;
  indexHasPayloads = fieldInfo.hasPayloads();
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:9,代码来源:Lucene41PostingsReader.java

示例7: EverythingEnum

import org.apache.lucene.index.FieldInfo; //导入方法依赖的package包/类
public EverythingEnum(FieldInfo fieldInfo) throws IOException {
  this.startDocIn = Lucene41PostingsReader.this.docIn;
  this.docIn = null;
  this.posIn = Lucene41PostingsReader.this.posIn.clone();
  this.payIn = Lucene41PostingsReader.this.payIn.clone();
  encoded = new byte[MAX_ENCODED_SIZE];
  indexHasOffsets = fieldInfo.getIndexOptions().compareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0;
  if (indexHasOffsets) {
    offsetStartDeltaBuffer = new int[MAX_DATA_SIZE];
    offsetLengthBuffer = new int[MAX_DATA_SIZE];
  } else {
    offsetStartDeltaBuffer = null;
    offsetLengthBuffer = null;
    startOffset = -1;
    endOffset = -1;
  }

  indexHasPayloads = fieldInfo.hasPayloads();
  if (indexHasPayloads) {
    payloadLengthBuffer = new int[MAX_DATA_SIZE];
    payloadBytes = new byte[128];
    payload = new BytesRef();
  } else {
    payloadLengthBuffer = null;
    payloadBytes = null;
    payload = null;
  }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:29,代码来源:Lucene41PostingsReader.java

示例8: decodeTerm

import org.apache.lucene.index.FieldInfo; //导入方法依赖的package包/类
@Override
public void decodeTerm(long[] longs, DataInput in, FieldInfo fieldInfo, BlockTermState _termState, boolean absolute)
  throws IOException {
  final IntBlockTermState termState = (IntBlockTermState) _termState;
  final boolean fieldHasPositions = fieldInfo.getIndexOptions().compareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0;
  final boolean fieldHasOffsets = fieldInfo.getIndexOptions().compareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0;
  final boolean 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 > BLOCK_SIZE) {
      termState.lastPosBlockOffset = in.readVLong();
    } else {
      termState.lastPosBlockOffset = -1;
    }
  }
  if (termState.docFreq > BLOCK_SIZE) {
    termState.skipOffset = in.readVLong();
  } else {
    termState.skipOffset = -1;
  }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:43,代码来源:Lucene41PostingsReader.java

示例9: canReuse

import org.apache.lucene.index.FieldInfo; //导入方法依赖的package包/类
public boolean canReuse(IndexInput docIn, FieldInfo fieldInfo) {
  return docIn == startDocIn &&
    indexHasFreq == (fieldInfo.getIndexOptions().compareTo(IndexOptions.DOCS_AND_FREQS) >= 0) &&
    indexHasPos == (fieldInfo.getIndexOptions().compareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0) &&
    indexHasPayloads == fieldInfo.hasPayloads();
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:7,代码来源:Lucene41PostingsReader.java


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