org.hibernate.search.backend.lucene.cfg.LuceneBackendSettings Maven / Gradle / Ivy
/*
* Hibernate Search, full-text search for your domain model
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later
* See the lgpl.txt file in the root directory or .
*/
package org.hibernate.search.backend.lucene.cfg;
import org.hibernate.search.backend.lucene.analysis.LuceneAnalysisConfigurer;
import org.hibernate.search.backend.lucene.cache.QueryCachingConfigurer;
import org.hibernate.search.backend.lucene.multitenancy.MultiTenancyStrategyName;
import org.hibernate.search.backend.lucene.schema.SchemaIdStrategy;
import org.apache.lucene.util.Version;
/**
* Configuration properties for Lucene backends.
*
* Constants in this class are to be appended to a prefix to form a property key;
* see {@link org.hibernate.search.engine.cfg.BackendSettings} for details.
*/
public final class LuceneBackendSettings {
private LuceneBackendSettings() {
}
/**
* The value to set the {@link org.hibernate.search.engine.cfg.BackendSettings#TYPE backend type}
* configuration property to
* in order to get a Lucene backend instantiated by Hibernate Search.
*
* Only useful if you have more than one backend technology in the classpath;
* otherwise the backend type is automatically detected.
*/
public static final String TYPE_NAME = "lucene";
/**
* The Lucene version to passed to analyzers when they are created.
*
* This should be set in order to get consistent behavior when Lucene is upgraded.
*
* Expects a Lucene {@link org.apache.lucene.util.Version} object,
* or a String accepted by {@link org.apache.lucene.util.Version#parseLeniently(java.lang.String)}
*
* Defaults to {@link Defaults#LUCENE_VERSION}, which may change when Hibernate Search or Lucene is upgraded,
* and therefore does not offer any backwards-compatibility guarantees.
* The recommended approach is to set this property explicitly to the version of Lucene you want to target.
*/
public static final String LUCENE_VERSION = "lucene_version";
/**
* How to implement multi-tenancy.
*
* Expects a {@link MultiTenancyStrategyName} value, or a String representation of such value.
*
* Defaults to {@link Defaults#MULTI_TENANCY_STRATEGY}.
*/
public static final String MULTI_TENANCY_STRATEGY = "multi_tenancy.strategy";
/**
* The configurer for analysis.
*
* Expects a single-valued or multi-valued reference to beans of type {@link LuceneAnalysisConfigurer}.
*
* Defaults to no value.
*
* @see org.hibernate.search.engine.cfg The core documentation of configuration properties,
* which includes a description of the "multi-valued bean reference" properties and accepted values.
*/
public static final String ANALYSIS_CONFIGURER = "analysis.configurer";
/**
* The configurer for query caching.
*
* Expects a single-valued or multi-valued reference to beans of type {@link QueryCachingConfigurer}.
*
* Defaults to no value.
*
* @see org.hibernate.search.engine.cfg The core documentation of configuration properties,
* which includes a description of the "multi-valued bean reference" properties and accepted values.
*/
public static final String QUERY_CACHING_CONFIGURER = "query.caching.configurer";
/**
* The size of the thread pool assigned to the backend.
*
* Expects a strictly positive integer value,
* or a string that can be parsed into an integer value.
*
* See the reference documentation, section "Lucene backend - Threads",
* for more information about this setting and its implications.
*
* Defaults to the number of processor cores available to the JVM on startup.
*/
public static final String THREAD_POOL_SIZE = "thread_pool.size";
/**
* Strategy that defines how to read/write IDs to/from a document.
*
* Expects a {@link SchemaIdStrategy} value, or a String representation of such value.
*
* Defaults to {@link Defaults#SCHEMA_ID_STRATEGY}.
*/
public static final String SCHEMA_ID_STRATEGY = "schema.id.strategy";
/**
* Default values for the different settings if no values are given.
*/
public static final class Defaults {
private Defaults() {
}
public static final Version LUCENE_VERSION = Version.LATEST;
/**
* @deprecated The default for this property is now dynamic and depends on the mapper.
* If the multi-tenancy is enabled in the mapper, the default is {@link MultiTenancyStrategyName#DISCRIMINATOR}.
* Otherwise, the default is still {@link MultiTenancyStrategyName#NONE}.
*/
@Deprecated
public static final MultiTenancyStrategyName MULTI_TENANCY_STRATEGY = MultiTenancyStrategyName.NONE;
@SuppressWarnings("deprecation")
public static final SchemaIdStrategy SCHEMA_ID_STRATEGY = SchemaIdStrategy.LUCENE_8;
}
}