All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.hibernate.search.analyzer.spi.AnalyzerStrategy 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.analyzer.spi;

import java.util.Collection;
import java.util.Map;

import org.hibernate.search.annotations.AnalyzerDef;

/**
 * A strategy for applying analyzers.
 *
 * @author Gunnar Morling
 * @author Yoann Rodiere
 * @hsearch.experimental This type is under active development as part of the Elasticsearch integration. You
 * should be prepared for incompatible changes in future releases.
 */
public interface AnalyzerStrategy {

	/**
	 * @return a reference to the default analyzer, the one to be used when no specific configuration is set
	 * on a given field.
	 */
	AnalyzerReference createDefaultAnalyzerReference();

	/**
	 * @return a reference to an analyzer that applies no operation whatsoever to the flux.
	 * This is useful for queries operating on non-tokenized fields.
	 */
	AnalyzerReference createPassThroughAnalyzerReference();

	/**
	 * @param name The name of the analyzer to be referenced.
	 * @return a reference that will be {@link #initializeAnalyzerReferences(Collection, Map) initialized later}.
	 */
	AnalyzerReference createNamedAnalyzerReference(String name);

	/**
	 * @return a reference to an instance of the given analyzer class that will be
	 * {@link #initializeAnalyzerReferences(Collection, Map) initialized later}.
	 */
	AnalyzerReference createAnalyzerReference(Class analyzerClass);

	/**
	 * Initializes references created by this strategy, i.e. make them point to the actual analyzer definition.
	 * @param references The references to initialize, mapped by name.
	 * @param analyzerDefinitions The analyzer definitions gathered through the Hibernate Search mappings.
	 */
	void initializeAnalyzerReferences(Collection references, Map analyzerDefinitions);

	/**
	 * @return A {@link ScopedAnalyzerReference} builder. The returned reference will be
	 * {@link #initializeAnalyzerReferences(Collection, Map) initialized later}.
	 */
	ScopedAnalyzerReference.Builder buildScopedAnalyzerReference(AnalyzerReference initialGlobalAnalyzerReference);

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy