Skip to content

Commit

Permalink
Implementation of ElasticSearch v8
Browse files Browse the repository at this point in the history
Manage indexing Magnolia Page on ES when you publish
  • Loading branch information
andreapagliacci committed Jul 18, 2023
1 parent 6382a5c commit 247c242
Show file tree
Hide file tree
Showing 114 changed files with 5,121 additions and 302 deletions.
48 changes: 42 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<artifactId>magnolia-cms-content-app-elasticsearch</artifactId>
<name>ElasticSearch-S3-Content-app-for-Magnolia</name>
<packaging>jar</packaging>
<version>1.5.5</version>
<version>1.6.0</version>

<properties>
<magnoliaBundleVersion>6.2.8</magnoliaBundleVersion>
Expand Down Expand Up @@ -49,7 +49,43 @@
<version>2.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>info.magnolia</groupId>
<artifactId>magnolia-templating</artifactId>
</dependency>

<dependency>
<groupId>info.magnolia.publishing</groupId>
<artifactId>magnolia-publishing-core</artifactId>
</dependency>

<dependency>
<groupId>info.magnolia.publishing</groupId>
<artifactId>magnolia-publishing-receiver</artifactId>
<version>1.3.8</version>
</dependency>
<dependency>
<groupId>info.magnolia.categorization</groupId>
<artifactId>magnolia-categorization-app-compatibility</artifactId>
<version>2.9.1</version>
</dependency>

<dependency>
<groupId>info.magnolia.templating</groupId>
<artifactId>magnolia-templating-essentials-models</artifactId>
</dependency>

<!-- Elastic Search integration v8 -->
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>elasticsearch-rest-client</artifactId>
<version>8.7.1</version>
</dependency>
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>elasticsearch-rest-client-sniffer</artifactId>
<version>8.7.1</version>
</dependency>
<!-- Elastic Search integration -->
<dependency>
<groupId>org.elasticsearch.plugin</groupId>
Expand Down Expand Up @@ -137,11 +173,11 @@
<!-- default resources configuration which will filter the module descriptor -->
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.java</include>
</includes>
</resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.java</include>
</includes>
</resource>
<resource>
<directory>src/main/resources</directory>
<includes>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
*/
package info.magnolia.forge.universalcontent.app.aws.s3;

import javax.inject.Inject;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand All @@ -16,7 +18,10 @@
import info.magnolia.forge.universalcontent.app.custom.interfaces.CustomConnection;
import info.magnolia.forge.universalcontent.app.generic.connection.ParameterConnection;
import info.magnolia.forge.universalcontent.app.generic.connection.S3ParameterConnection;
import info.magnolia.forge.universalcontent.app.manageES.ElasticSearchModuleCore;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;

/**
* Create a general purpose connection with AWS S3 instance
Expand All @@ -28,6 +33,10 @@ public class S3Connection implements CustomConnection {
AmazonS3 client;
AWSCredentials credentials;
ParameterConnection params;
@Setter
@Getter
@Inject
ElasticSearchModuleCore elasticSearchModule;

/**
* Instantiates a S3 connection.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package info.magnolia.forge.universalcontent.app.custom.interfaces;

import info.magnolia.forge.universalcontent.app.generic.connection.ParameterConnection;
import info.magnolia.forge.universalcontent.app.manageES.ElasticSearchModuleCore;

public interface CustomConnection {
public void connection(ParameterConnection params);
Expand All @@ -12,4 +13,8 @@ public interface CustomConnection {
public void setParams(ParameterConnection parameterConnection);

public void connect();

public ElasticSearchModuleCore getElasticSearchModule();

public void setElasticSearchModule(ElasticSearchModuleCore elasticSearchModuleCore);
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import com.vaadin.v7.data.Container;

import info.magnolia.forge.universalcontent.app.generic.connector.GenericContentConnector;
import info.magnolia.forge.universalcontent.app.generic.entity.GenericItem;
import info.magnolia.forge.universalcontent.app.generic.others.GenericException;
import info.magnolia.forge.universalcontent.app.generic.search.Params;
Expand All @@ -20,4 +21,7 @@ public interface CustomContainer extends Container.Hierarchical, Container.ItemS
void createConnection(Params params) throws Exception;

public void refreshDelegate(Params params) throws GenericException;

public GenericContentConnector<GenericItem> getGenericContentConnector();

}
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,9 @@ public interface CustomContentConnector extends GenericContentConnector, Elastic

public List<OrderBy> getSorters();

@Override
public Class<? extends GenericItem> getTypeClass();

public void setTypeClass(Class<? extends GenericItem> typeClass);

}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import co.elastic.clients.elasticsearch.indices.CreateIndexRequest;
import co.elastic.clients.util.ObjectBuilder;
import info.magnolia.forge.universalcontent.app.custom.interfaces.CustomConnection;
import info.magnolia.forge.universalcontent.app.elasticsearch.connector.ElasticSearchConnection;
import info.magnolia.forge.universalcontent.app.generic.annotation.DelegateImplementation;
import info.magnolia.forge.universalcontent.app.generic.connection.ElasticSearchParameterConnection;
import info.magnolia.forge.universalcontent.app.generic.connector.GenericDelegate;
Expand All @@ -53,7 +54,6 @@
@Data
@DelegateImplementation(parameterClass = ElasticSearchParameterConnection.class)
public class ElasticSearchDelegate<T extends GenericItem> extends GenericDelegate<T> {
/** The query builder. */
Function<Builder, ObjectBuilder<Query>> queryBuilder = null;

@Inject
Expand Down
Loading

0 comments on commit 247c242

Please sign in to comment.