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); }
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); } }
/** * 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()); }
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; }
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); } }
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); } }
@Override public void writeTo(StreamOutput out) throws IOException { shardId.writeTo(out); out.writeBoolean(primary); Version.writeVersion(upgradeVersion, out); out.writeString(oldestLuceneSegment.toString()); } }
@Override public void writeTo(StreamOutput out) throws IOException { out.writeString(name); out.writeVLong(length); out.writeString(checksum); out.writeString(writtenBy.toString()); out.writeBytesRef(hash); }
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 - " +
/** * 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(); } }
@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; }
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; } }
@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); }
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; }
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; }
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; }
@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); } } }
@Override public void writeTo(StreamOutput out) throws IOException { shardId.writeTo(out); out.writeBoolean(primary); Version.writeVersion(upgradeVersion, out); out.writeString(oldestLuceneSegment.toString()); } }
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() ); }
@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(); }