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


Java FieldInfo.getIndexOptions方法代码示例

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


在下文中一共展示了FieldInfo.getIndexOptions方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: Lucene3xFields

import org.apache.lucene.index.FieldInfo; //导入方法依赖的package包/类
public Lucene3xFields(Directory dir, FieldInfos fieldInfos, SegmentInfo info, IOContext context, int indexDivisor)
  throws IOException {

  si = info;

  // NOTE: we must always load terms index, even for
  // "sequential" scan during merging, because what is
  // sequential to merger may not be to TermInfosReader
  // since we do the surrogates dance:
  if (indexDivisor < 0) {
    indexDivisor = -indexDivisor;
  }
  
  boolean success = false;
  try {
    TermInfosReader r = newTermInfosReader(dir, info.name, fieldInfos, context, indexDivisor);    
    if (indexDivisor == -1) {
      tisNoIndex = r;
    } else {
      tisNoIndex = null;
      tis = r;
    }
    this.context = context;
    this.fieldInfos = fieldInfos;

    // make sure that all index files have been read or are kept open
    // so that if an index update removes them we'll still have them
    freqStream = dir.openInput(IndexFileNames.segmentFileName(info.name, "", Lucene3xPostingsFormat.FREQ_EXTENSION), context);
    boolean anyProx = false;
    for (FieldInfo fi : fieldInfos) {
      if (fi.isIndexed()) {
        fields.put(fi.name, fi);
        preTerms.put(fi.name, new PreTerms(fi));
        if (fi.getIndexOptions() == IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) {
          anyProx = true;
        }
      }
    }

    if (anyProx) {
      proxStream = dir.openInput(IndexFileNames.segmentFileName(info.name, "", Lucene3xPostingsFormat.PROX_EXTENSION), context);
    } else {
      proxStream = null;
    }
    success = true;
  } finally {
    // With lock-less commits, it's entirely possible (and
    // fine) to hit a FileNotFound exception above. In
    // this case, we want to explicitly close any subset
    // of things that were opened so that we don't have to
    // wait for a GC to do so.
    if (!success) {
      close();
    }
  }
  this.dir = dir;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:58,代码来源:Lucene3xFields.java


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