org.apache.lucene.util.Version.onOrAfter()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(8.9k)|赞(0)|评价(0)|浏览(65)

本文整理了Java中org.apache.lucene.util.Version.onOrAfter()方法的一些代码示例,展示了Version.onOrAfter()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Version.onOrAfter()方法的具体详情如下:
包路径:org.apache.lucene.util.Version
类名称:Version
方法名:onOrAfter

Version.onOrAfter介绍

[英]Returns true if this version is the same or after the version from the argument.
[中]如果此版本与参数中的版本相同或在该版本之后,则返回true。

代码示例

代码示例来源:origin: org.apache.lucene/lucene-core

/** Expert: Sole constructor. Public for use by custom {@link LeafReader} impls. */
public LeafMetaData(int createdVersionMajor, Version minVersion, Sort sort) {
 this.createdVersionMajor = createdVersionMajor;
 if (createdVersionMajor > Version.LATEST.major) {
  throw new IllegalArgumentException("createdVersionMajor is in the future: " + createdVersionMajor);
 }
 if (createdVersionMajor < 6) {
  throw new IllegalArgumentException("createdVersionMajor must be >= 6, got: " + createdVersionMajor);
 }
 if (minVersion != null && minVersion.onOrAfter(Version.LUCENE_7_0_0) == false) {
  throw new IllegalArgumentException("minVersion must be >= 7.0.0: " + minVersion);
 }
 if (createdVersionMajor >= 7 && minVersion == null) {
  throw new IllegalArgumentException("minVersion must be set when createdVersionMajor is >= 7");
 }
 this.minVersion = minVersion;
 this.sort = sort;
}

代码示例来源:origin: org.apache.lucene/lucene-core

/** Confirms that the incoming index sort (if any) matches the existing index sort (if any).
 *  This is unfortunately just best effort, because it could be the old index only has unsorted flushed segments built
 *  before {@link Version#LUCENE_6_5_0} (flushed segments are sorted in Lucene 7.0).  */
private void validateIndexSort() throws CorruptIndexException {
 Sort indexSort = config.getIndexSort();
 if (indexSort != null) {
  for(SegmentCommitInfo info : segmentInfos) {
   Sort segmentIndexSort = info.info.getIndexSort();
   if (segmentIndexSort != null && indexSort.equals(segmentIndexSort) == false) {
    throw new IllegalArgumentException("cannot change previous indexSort=" + segmentIndexSort + " (from segment=" + info + ") to new indexSort=" + indexSort);
   } else if (segmentIndexSort == null && info.info.getVersion().onOrAfter(Version.LUCENE_6_5_0)) {
    // Flushed segments are not sorted if they were built with a version prior to 6.5.0
    throw new CorruptIndexException("segment not sorted with indexSort=" + segmentIndexSort, info.info.toString());
   }
  }
 }
}

代码示例来源:origin: org.apache.lucene/lucene-core

minVersion = null;
 break;
} else if (minVersion.onOrAfter(leafVersion)) {
 minVersion = leafVersion;

代码示例来源:origin: org.apache.lucene/lucene-core

SegmentMerger(List<CodecReader> readers, SegmentInfo segmentInfo, InfoStream infoStream, Directory dir,
       FieldInfos.FieldNumbers fieldNumbers, IOContext context) throws IOException {
 if (context.context != IOContext.Context.MERGE) {
  throw new IllegalArgumentException("IOContext.context should be MERGE; got: " + context.context);
 }
 mergeState = new MergeState(readers, segmentInfo, infoStream);
 directory = dir;
 this.codec = segmentInfo.getCodec();
 this.context = context;
 this.fieldInfosBuilder = new FieldInfos.Builder(fieldNumbers);
 Version minVersion = Version.LATEST;
 for (CodecReader reader : readers) {
  Version leafMinVersion = reader.getMetaData().getMinVersion();
  if (leafMinVersion == null) {
   minVersion = null;
   break;
  }
  if (minVersion.onOrAfter(leafMinVersion)) {
   minVersion = leafMinVersion;
  }
 }
 assert segmentInfo.minVersion == null : "The min version should be set by SegmentMerger for merged segments";
 segmentInfo.minVersion = minVersion;
 if (mergeState.infoStream.isEnabled("SM")) {
  if (segmentInfo.getIndexSort() != null) {
   mergeState.infoStream.message("SM", "index sort during merge: " + segmentInfo.getIndexSort());
  }
 }
}

代码示例来源:origin: org.apache.lucene/lucene-core

int endOffset = postings.endOffset();
if (isVectors == false || version.onOrAfter(Version.LUCENE_7_0_0)) {
 if (startOffset < 0) {
  throw new RuntimeException("term " + term + ": doc " + doc + ": pos " + pos + ": startOffset " + startOffset + " is out of bounds");

代码示例来源:origin: org.apache.lucene/lucene-core

if (oldest == null || version.onOrAfter(oldest) == false) {
 oldest = version;
if (newest == null || version.onOrAfter(newest)) {
 newest = version;

代码示例来源:origin: org.apache.lucene/lucene-core

if (minSegmentVersion == null || segmentVersion.onOrAfter(minSegmentVersion) == false) {
 minSegmentVersion = segmentVersion;

代码示例来源:origin: org.apache.lucene/lucene-core

if (luceneVersion.onOrAfter(Version.LUCENE_6_0_0) == false) {
 if (segmentVersion.onOrAfter(infos.minSegmentLuceneVersion) == false) {
  throw new CorruptIndexException("segments file recorded minSegmentLuceneVersion=" + infos.minSegmentLuceneVersion + " but segment=" + info + " has older version=" + segmentVersion, input);

代码示例来源:origin: org.elasticsearch/elasticsearch

public org.apache.lucene.util.Version minimumCompatibleVersion() {
  org.apache.lucene.util.Version luceneVersion = null;
  for (Segment segment : getEngine().segments(false)) {
    if (luceneVersion == null || luceneVersion.onOrAfter(segment.getVersion())) {
      luceneVersion = segment.getVersion();
    }
  }
  return luceneVersion == null ? indexSettings.getIndexVersionCreated().luceneVersion : luceneVersion;
}

代码示例来源:origin: org.elasticsearch/elasticsearch

if (version.onOrAfter(maxVersion)) {
  maxVersion = version;

代码示例来源:origin: org.elasticsearch/elasticsearch

if (result.oldestLuceneSegment().onOrAfter(versionTuple.v2()) == false) {
  luceneVersion = result.oldestLuceneSegment();

代码示例来源:origin: org.apache.lucene/lucene-analyzers

/**
 * Builds an analyzer with the default stop words.
 * 
 * @param matchVersion lucene compatibility version
 */
public ThaiAnalyzer(Version matchVersion) {
 this(matchVersion, matchVersion.onOrAfter(Version.LUCENE_36) ? DefaultSetHolder.DEFAULT_STOP_SET : StopAnalyzer.ENGLISH_STOP_WORDS_SET);
}

代码示例来源:origin: apache/tika

SlowCompositeReaderWrapper(CompositeReader reader) throws IOException {
  super();
  in = reader;
  fields = MultiFields.getFields(in);
  in.registerParentReader(this);
  if (reader.leaves().isEmpty()) {
    metaData = new LeafMetaData(Version.LATEST.major, Version.LATEST, null);
  } else {
    Version minVersion = Version.LATEST;
    for (LeafReaderContext leafReaderContext : reader.leaves()) {
      Version leafVersion = leafReaderContext.reader().getMetaData().getMinVersion();
      if (leafVersion == null) {
        minVersion = null;
        break;
      } else if (minVersion.onOrAfter(leafVersion)) {
        minVersion = leafVersion;
      }
    }
    metaData = new LeafMetaData(reader.leaves().get(0).reader().getMetaData().getCreatedVersionMajor(), minVersion, null);
  }
}

代码示例来源:origin: org.apache.lucene/lucene-analyzers

/** Creates a new ThaiWordFilter with the specified match version. */
public ThaiWordFilter(Version matchVersion, TokenStream input) {
 super(matchVersion.onOrAfter(Version.LUCENE_31) ?
  input : new LowerCaseFilter(matchVersion, input));
 if (!DBBI_AVAILABLE)
  throw new UnsupportedOperationException("This JRE does not have support for Thai segmentation");
 handlePosIncr = matchVersion.onOrAfter(Version.LUCENE_31);
}

代码示例来源:origin: rdelbru/SIREn

private static Version parseConfiguredVersion(final String configuredVersion, final String pluginClassName, final Version luceneMatchVersion) {
 final Version version = (configuredVersion != null) ?
  Config.parseLuceneVersionString(configuredVersion) : luceneMatchVersion;
 if (!version.onOrAfter(Version.LUCENE_40)) {
  logger.warn(pluginClassName + " is using deprecated " + version +
   " emulation. You should at some point declare and reindex to at least 4.0, because " +
   "3.x emulation is deprecated and will be removed in 5.0");
 }
 return version;
}

代码示例来源:origin: org.apache.lucene/lucene-analyzers

public DutchAnalyzer(Version matchVersion, Set<?> stopwords){
 // historically, this ctor never the stem dict!!!!!
 // so we populate it only for >= 3.6
 this(matchVersion, stopwords, CharArraySet.EMPTY_SET, 
   matchVersion.onOrAfter(Version.LUCENE_36) 
   ? DefaultSetHolder.DEFAULT_STEM_DICT 
   : CharArrayMap.<String>emptyMap());
}

代码示例来源:origin: org.infinispan/infinispan-embedded-query

@Override
 public TokenStream create(TokenStream input) {
  if (luceneMatchVersion.onOrAfter(Version.LUCENE_4_4_0)) {
   return new StopFilter(input, stopWords);
  } else {
   @SuppressWarnings("deprecation")
   final TokenStream filter = new Lucene43StopFilter(enablePositionIncrements, input, stopWords);
   return filter;
  }
 }
}

代码示例来源:origin: org.infinispan/infinispan-embedded-query

@Override
 public Tokenizer create(AttributeFactory factory) {
  if (luceneMatchVersion.onOrAfter(Version.LUCENE_4_4_0)) {
   return new EdgeNGramTokenizer(factory, minGramSize, maxGramSize);
  }
  return new Lucene43NGramTokenizer(factory, minGramSize, maxGramSize);
 }
}

代码示例来源:origin: harbby/presto-connectors

@Override
 public TokenFilter create(TokenStream input) {
  if (luceneMatchVersion.onOrAfter(Version.LUCENE_4_4_0)) {
   return new NGramTokenFilter(input, minGramSize, maxGramSize);
  }
  return new Lucene43NGramTokenFilter(input, minGramSize, maxGramSize);
 }
}

代码示例来源:origin: harbby/presto-connectors

@Override
  public TokenStream create(TokenStream tokenStream, Version version) {
    if (version.luceneVersion.onOrAfter(org.apache.lucene.util.Version.LUCENE_4_4_0)) {
      return new EdgeNGramTokenFilter(tokenStream, EdgeNGramTokenFilter.DEFAULT_MIN_GRAM_SIZE, EdgeNGramTokenFilter.DEFAULT_MAX_GRAM_SIZE);
    } else {
      @SuppressWarnings("deprecation")
      final TokenStream filter = new Lucene43EdgeNGramTokenFilter(tokenStream, EdgeNGramTokenFilter.DEFAULT_MIN_GRAM_SIZE, EdgeNGramTokenFilter.DEFAULT_MAX_GRAM_SIZE);
      return filter;
    }
  }
},

相关文章