Skip to content

Commit

Permalink
HSEARCH-3101 Use aliases for backend types and make them point to the…
Browse files Browse the repository at this point in the history
… right backend factory
  • Loading branch information
yrodiere committed Dec 4, 2018
1 parent f001ea4 commit 8dedcb9
Show file tree
Hide file tree
Showing 11 changed files with 54 additions and 10 deletions.
@@ -0,0 +1,21 @@
/*
* 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 <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.search.backend.elasticsearch.impl;

import org.hibernate.search.engine.backend.spi.BackendFactory;
import org.hibernate.search.engine.environment.bean.spi.BeanConfigurationContext;
import org.hibernate.search.engine.environment.bean.spi.BeanConfigurer;

public class ElasticsearchBeanConfigurer implements BeanConfigurer {
@Override
public void configure(BeanConfigurationContext context) {
context.define(
BackendFactory.class, "elasticsearch",
factoryCreationContext -> new ElasticsearchBackendFactory()
);
}
}
@@ -0,0 +1 @@
org.hibernate.search.backend.elasticsearch.impl.ElasticsearchBeanConfigurer
@@ -0,0 +1,21 @@
/*
* 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 <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.search.backend.lucene.impl;

import org.hibernate.search.engine.backend.spi.BackendFactory;
import org.hibernate.search.engine.environment.bean.spi.BeanConfigurationContext;
import org.hibernate.search.engine.environment.bean.spi.BeanConfigurer;

public class LuceneBeanConfigurer implements BeanConfigurer {
@Override
public void configure(BeanConfigurationContext context) {
context.define(
BackendFactory.class, "lucene",
factoryCreationContext -> new LuceneBackendFactory()
);
}
}
@@ -0,0 +1 @@
org.hibernate.search.backend.lucene.impl.LuceneBeanConfigurer
8 changes: 4 additions & 4 deletions documentation/src/test/resources/META-INF/persistence.xml
Expand Up @@ -21,7 +21,7 @@
<properties>
<!-- tag::gettingstarted-configuration-orm_lucene[] -->
<property name="hibernate.search.backends.myBackend.type"
value="org.hibernate.search.backend.lucene.impl.LuceneBackendFactory"/> <!--1-->
value="lucene"/> <!--1-->
<property name="hibernate.search.backends.myBackend.lucene.directory_provider"
value="local_directory"/> <!--2-->
<!--
Expand Down Expand Up @@ -50,7 +50,7 @@
<properties>
<!-- tag::gettingstarted-configuration-orm_elasticsearch[] -->
<property name="hibernate.search.backends.myBackend.type"
value="org.hibernate.search.backend.elasticsearch.impl.ElasticsearchBackendFactory" /> <!--1-->
value="elasticsearch" /> <!--1-->
<!--
<property name="hibernate.search.backends.myBackend.host"
value="https://elasticsearch.mycompany.com"/>
Expand Down Expand Up @@ -84,7 +84,7 @@
<exclude-unlisted-classes />
<properties>
<property name="hibernate.search.backends.myBackend.type"
value="org.hibernate.search.backend.lucene.impl.LuceneBackendFactory"/>
value="lucene"/>
<property name="hibernate.search.backends.myBackend.lucene.directory_provider"
value="local_directory"/>
<!-- tag::gettingstarted-configuration-orm_lucene-analysis[] -->
Expand All @@ -111,7 +111,7 @@
<exclude-unlisted-classes />
<properties>
<property name="hibernate.search.backends.myBackend.type"
value="org.hibernate.search.backend.elasticsearch.impl.ElasticsearchBackendFactory" />
value="elasticsearch" />
<!-- tag::gettingstarted-configuration-orm_elasticsearch-analysis[] -->
<property name="hibernate.search.backends.myBackend.analysis_configurer"
value="org.hibernate.search.documentation.gettingstarted.withhsearch.withanalysis.MyElasticsearchAnalysisConfigurer"/> <!--6-->
Expand Down
@@ -1,4 +1,4 @@
backend.type org.hibernate.search.backend.elasticsearch.impl.ElasticsearchBackendFactory
backend.type elasticsearch
backend.host ${test.elasticsearch.host.url}
backend.username ${test.elasticsearch.host.username}
backend.password ${test.elasticsearch.host.password}
Expand Down
@@ -1,4 +1,4 @@
backend.type org.hibernate.search.backend.elasticsearch.impl.ElasticsearchBackendFactory
backend.type elasticsearch
backend.host ${test.elasticsearch.host.url}
backend.username ${test.elasticsearch.host.username}
backend.password ${test.elasticsearch.host.password}
Expand Down
@@ -1,4 +1,4 @@
backend.type org.hibernate.search.backend.elasticsearch.impl.ElasticsearchBackendFactory
backend.type elasticsearch
backend.host ${test.elasticsearch.host.url}
backend.username ${test.elasticsearch.host.username}
backend.password ${test.elasticsearch.host.password}
Expand Down
@@ -1,4 +1,4 @@
backend.type org.hibernate.search.backend.lucene.impl.LuceneBackendFactory
backend.type lucene
backend.lucene.directory_provider local_directory
backend.lucene.root_directory ${project.build.directory}/test-indexes/#{tck.startup.timestamp}/#{tck.test.id}/
backend.analysis_configurer org.hibernate.search.integrationtest.backend.lucene.configuration.AnalysisCustomITAnalysisConfigurer
@@ -1,4 +1,4 @@
backend.type org.hibernate.search.backend.lucene.impl.LuceneBackendFactory
backend.type lucene
backend.lucene.directory_provider local_directory
backend.lucene.root_directory ${project.build.directory}/test-indexes/#{tck.startup.timestamp}/#{tck.test.id}/
backend.analysis_configurer org.hibernate.search.integrationtest.backend.lucene.configuration.DefaultITAnalysisConfigurer
Expand Down
@@ -1,4 +1,4 @@
backend.type org.hibernate.search.backend.lucene.impl.LuceneBackendFactory
backend.type lucene
backend.lucene.directory_provider local_directory
backend.lucene.root_directory ${project.build.directory}/test-indexes/#{tck.startup.timestamp}/#{tck.test.id}/
backend.analysis_configurer org.hibernate.search.integrationtest.backend.lucene.configuration.DefaultITAnalysisConfigurer

0 comments on commit 8dedcb9

Please sign in to comment.