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

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

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

Version.toString介绍

暂无

代码示例

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

private static void setDiagnostics(SegmentInfo info, String source, Map<String,String> details) {
 Map<String,String> diagnostics = new HashMap<>();
 diagnostics.put("source", source);
 diagnostics.put("lucene.version", Version.LATEST.toString());
 diagnostics.put("os", Constants.OS_NAME);
 diagnostics.put("os.arch", Constants.OS_ARCH);
 diagnostics.put("os.version", Constants.OS_VERSION);
 diagnostics.put("java.version", Constants.JAVA_VERSION);
 diagnostics.put("java.vendor", Constants.JAVA_VENDOR);
 // On IBM J9 JVM this is better than java.version which is just 1.7.0 (no update level):
 diagnostics.put("java.runtime.version", System.getProperty("java.runtime.version", "undefined"));
 // Hotspot version, e.g. 2.8 for J9:
 diagnostics.put("java.vm.version", System.getProperty("java.vm.version", "undefined"));
 diagnostics.put("timestamp", Long.toString(new Date().getTime()));
 if (details != null) {
  diagnostics.putAll(details);
 }
 info.setDiagnostics(diagnostics);
}

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

private void messageState() {
 if (infoStream.isEnabled("IW") && didMessageState == false) {
  didMessageState = true;
  infoStream.message("IW", "\ndir=" + directoryOrig + "\n" +
     "index=" + segString() + "\n" +
     "version=" + Version.LATEST.toString() + "\n" +
     config.toString());
  final StringBuilder unmapInfo = new StringBuilder(Boolean.toString(MMapDirectory.UNMAP_SUPPORTED));
  if (!MMapDirectory.UNMAP_SUPPORTED) {
   unmapInfo.append(" (").append(MMapDirectory.UNMAP_NOT_SUPPORTED_REASON).append(")");
  }
  infoStream.message("IW", "MMapDirectory.UNMAP_SUPPORTED=" + unmapInfo);
 }
}

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

/**
 * Sets an lucene version setting with the provided setting key and lucene version instance.
 *
 * @param key  The setting key
 * @param luceneVersion The setting value
 * @return The builder
 */
public Builder put(String key, org.apache.lucene.util.Version luceneVersion) {
  return put(key, luceneVersion.toString());
}

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

private Map<String,String> applyDefaultParams(Map<String,String> map) {
 if (defaultMatchVersion.get() != null && !map.containsKey(AbstractAnalysisFactory.LUCENE_MATCH_VERSION_PARAM)) {
  map.put(AbstractAnalysisFactory.LUCENE_MATCH_VERSION_PARAM, defaultMatchVersion.get().toString());
 }
 return map;
}

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

public SynonymGraphFilterFactory(Map<String,String> args) {
 super(args);
 ignoreCase = getBoolean(args, "ignoreCase", false);
 synonyms = require(args, "synonyms");
 format = get(args, "format");
 expand = getBoolean(args, "expand", true);
 analyzerName = get(args, "analyzer");
 tokenizerFactory = get(args, "tokenizerFactory");
 if (analyzerName != null && tokenizerFactory != null) {
  throw new IllegalArgumentException("Analyzer and TokenizerFactory can't be specified both: " +
                    analyzerName + " and " + tokenizerFactory);
 }
 if (tokenizerFactory != null) {
  tokArgs.put("luceneMatchVersion", getLuceneMatchVersion().toString());
  for (Iterator<String> itr = args.keySet().iterator(); itr.hasNext();) {
   String key = itr.next();
   tokArgs.put(key.replaceAll("^tokenizerFactory\\.",""), args.get(key));
   itr.remove();
  }
 }
 if (!args.isEmpty()) {
  throw new IllegalArgumentException("Unknown parameters: " + args);
 }
}

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

public SynonymFilterFactory(Map<String,String> args) {
 super(args);
 ignoreCase = getBoolean(args, "ignoreCase", false);
 synonyms = require(args, "synonyms");
 format = get(args, "format");
 expand = getBoolean(args, "expand", true);
 analyzerName = get(args, "analyzer");
 tokenizerFactory = get(args, "tokenizerFactory");
 if (analyzerName != null && tokenizerFactory != null) {
  throw new IllegalArgumentException("Analyzer and TokenizerFactory can't be specified both: " +
                    analyzerName + " and " + tokenizerFactory);
 }
 if (tokenizerFactory != null) {
  tokArgs.put("luceneMatchVersion", getLuceneMatchVersion().toString());
  for (Iterator<String> itr = args.keySet().iterator(); itr.hasNext();) {
   String key = itr.next();
   tokArgs.put(key.replaceAll("^tokenizerFactory\\.",""), args.get(key));
   itr.remove();
  }
 }
 if (!args.isEmpty()) {
  throw new IllegalArgumentException("Unknown parameters: " + args);
 }
}

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

@Override
  public void writeTo(StreamOutput out) throws IOException {
    shardId.writeTo(out);
    out.writeBoolean(primary);
    Version.writeVersion(upgradeVersion, out);
    out.writeString(oldestLuceneSegment.toString());
  }
}

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

@Override
public void writeTo(StreamOutput out) throws IOException {
  out.writeString(name);
  out.writeVLong(length);
  out.writeString(checksum);
  out.writeString(writtenBy.toString());
  out.writeBytesRef(hash);
}

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

int expectedPrimaryCount = metaData.index(index).getNumberOfShards();
if (primaryCount == metaData.index(index).getNumberOfShards()) {
  updatedVersions.put(index, new Tuple<>(versionEntry.getValue().v1(), versionEntry.getValue().v2().toString()));
} else {
  logger.warn("Not updating settings for the index [{}] because upgraded of some primary shards failed - " +

代码示例来源:origin: DSpace/DSpace

/**
   * Determine the version of Solr/Lucene which DSpace is currently running.
   * This is the latest version of Solr/Lucene which we can upgrade the index to.
   *
   * @return version as a string (e.g. "4.4")
   */
  public static String getLatestVersion() {
    // The current version of lucene is in the "LATEST" constant
    return org.apache.lucene.util.Version.LATEST.toString();
  }
}

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

@Override
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
  builder.startObject();
  builder.field("name", nodeName);
  builder.field("cluster_name", clusterName.value());
  builder.field("cluster_uuid", clusterUuid);
  builder.startObject("version")
    .field("number", version.toString())
    .field("build_flavor", build.flavor().displayName())
    .field("build_type", build.type().displayName())
    .field("build_hash", build.shortHash())
    .field("build_date", build.date())
    .field("build_snapshot", build.isSnapshot())
    .field("lucene_version", version.luceneVersion.toString())
    .field("minimum_wire_compatibility_version", version.minimumCompatibilityVersion().toString())
    .field("minimum_index_compatibility_version", version.minimumIndexCompatibilityVersion().toString())
    .endObject();
  builder.field("tagline", "You Know, for Search");
  builder.endObject();
  return builder;
}

代码示例来源:origin: hibernate/hibernate-search

private static Map<String, String> getMapOfParameters(Map<String, String> params, Version luceneMatchVersion) {
    Map<String, String> mapOfParams = new LinkedHashMap<>( params );
    params.put( LUCENE_VERSION_PARAM, luceneMatchVersion.toString() );
    return mapOfParams;
  }
}

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

@Override
public void writeTo(StreamOutput out) throws IOException {
  super.writeTo(out);
  out.writeLong(recoveryId);
  shardId.writeTo(out);
  out.writeString(metaData.name());
  out.writeVLong(position);
  out.writeVLong(metaData.length());
  out.writeString(metaData.checksum());
  out.writeBytesReference(content);
  out.writeString(metaData.writtenBy().toString());
  out.writeBoolean(lastChunk);
  out.writeVInt(totalTranslogOps);
  out.writeLong(sourceThrottleTimeInNanos);
}

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

private static Map<String, String> getMapOfParameters(Parameter[] params, Version luceneMatchVersion) {
  Map<String, String> mapOfParams = ParameterAnnotationsReader.toNewMutableMap( params );
  mapOfParams.put( LUCENE_VERSION_PARAM, luceneMatchVersion.toString() );
  return mapOfParams;
}

代码示例来源:origin: hibernate/hibernate-search

private static Map<String, String> getMapOfParameters(Parameter[] params, Version luceneMatchVersion) {
  Map<String, String> mapOfParams = ParameterAnnotationsReader.toNewMutableMap( params );
  mapOfParams.put( LUCENE_VERSION_PARAM, luceneMatchVersion.toString() );
  return mapOfParams;
}

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

private Map<String,String> applyDefaultParams(Map<String,String> map) {
 if (defaultMatchVersion.get() != null && !map.containsKey(AbstractAnalysisFactory.LUCENE_MATCH_VERSION_PARAM)) {
  map.put(AbstractAnalysisFactory.LUCENE_MATCH_VERSION_PARAM, defaultMatchVersion.get().toString());
 }
 return map;
}

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

@Override
public void writeTo(StreamOutput out) throws IOException {
  out.writeString(name);
  out.writeBoolean(committed);
  out.writeBoolean(search);
  out.writeInt(docCount);
  out.writeInt(delDocCount);
  out.writeLong(sizeInBytes);
  out.writeOptionalString(version.toString());
  out.writeOptionalBoolean(compound);
  out.writeOptionalString(mergeId);
  out.writeLong(memoryInBytes);
  boolean verbose = ramTree != null;
  out.writeBoolean(verbose);
  if (verbose) {
    writeRamTree(out, ramTree);
  }
  if (out.getVersion().onOrAfter(Version.V_6_0_0_alpha1)) {
    writeSegmentSort(out, segmentSort);
  }
  if (out.getVersion().onOrAfter(Version.V_6_1_0)) {
    boolean hasAttributes = attributes != null;
    out.writeBoolean(hasAttributes);
    if (hasAttributes) {
      out.writeMap(attributes, StreamOutput::writeString, StreamOutput::writeString);
    }
  }
}

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

@Override
  public void writeTo(StreamOutput out) throws IOException {
    shardId.writeTo(out);
    out.writeBoolean(primary);
    Version.writeVersion(upgradeVersion, out);
    out.writeString(oldestLuceneSegment.toString());
  }
}

代码示例来源:origin: hibernate/hibernate-search

private SearchConfigurationForTest(InstanceInitializer init, boolean expectsJPAAnnotations, Properties properties) {
  this.initializer = init;
  this.enableJPAAnnotationsProcessing = expectsJPAAnnotations;
  this.classes = new HashMap<String, Class<?>>();
  this.properties = properties;
  this.providedServices = new HashMap<Class<? extends Service>, Object>();
  this.classLoaderService = new DefaultClassLoaderService();
  addProperty( "hibernate.search.default.directory_provider", "local-heap" );
  addProperty( "hibernate.search.lucene_version", TestConstants.getTargetLuceneVersion().toString() );
}

代码示例来源:origin: hibernate/hibernate-search

@Test
public void testWarningLoggedForInconsistentFieldConfiguration() throws Exception {
  Configuration config = new Configuration();
  config.addAnnotatedClass( Product.class );
  config.setProperty( "hibernate.search.lucene_version", TestConstants.getTargetLuceneVersion().toString() );
  config.setProperty( "hibernate.search.default.directory_provider", "local-heap" );
  logged.expectMessage( "HSEARCH000120", Product.class.getName(), DEFAULT_FIELD_NAME );
  config.buildSessionFactory();
}

相关文章