Skip to content

Commit

Permalink
Texts repository
Browse files Browse the repository at this point in the history
  • Loading branch information
goulven authored and goulven committed Dec 16, 2024
1 parent 5c4753e commit 10dd7e1
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 2 deletions.
3 changes: 2 additions & 1 deletion api/src/main/java/org/open4goods/api/Api.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import org.open4goods.commons.services.SerialisationService;
import org.open4goods.commons.store.repository.elastic.BrandScoresRepository;
import org.open4goods.commons.store.repository.elastic.ElasticProductRepository;
import org.open4goods.commons.store.repository.elastic.ElasticTextRepository;
import org.open4goods.crawler.controller.CrawlController;
import org.open4goods.crawler.repository.IndexationRepository;
import org.slf4j.Logger;
Expand All @@ -28,7 +29,7 @@
@SpringBootApplication (scanBasePackageClasses = { Api.class, CrawlController.class, CacheKeyGenerator.class})

@EnableScheduling
@EnableElasticsearchRepositories(basePackageClasses = {ElasticProductRepository.class, IndexationRepository.class, BrandScoresRepository.class})
@EnableElasticsearchRepositories(basePackageClasses = {ElasticProductRepository.class, IndexationRepository.class, BrandScoresRepository.class, ElasticTextRepository.class})
//@EnableRedisRepositories(basePackageClasses = RedisProductRepository.class)
@EnableCaching

Expand Down
33 changes: 33 additions & 0 deletions commons/src/main/java/org/open4goods/commons/model/Text.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package org.open4goods.commons.model;

import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;
import org.springframework.data.elasticsearch.annotations.WriteTypeHint;

@Document(indexName = "texts", createIndex = true, writeTypeHint = WriteTypeHint.FALSE)
public class Text {

@Id
private String key;

@Field(index = false, store = false, type = FieldType.Text)
private String content;
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}




}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package org.open4goods.commons.store.repository.elastic;

import org.open4goods.commons.model.Text;
import org.open4goods.commons.model.product.Product;
import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;

/**
*
* @author goulven
*
*/

public interface ElasticTextRepository extends ElasticsearchRepository<Text, String> {



}
3 changes: 2 additions & 1 deletion ui/src/main/java/org/open4goods/ui/Ui.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import org.open4goods.commons.services.SerialisationService;
import org.open4goods.commons.store.repository.elastic.BrandScoresRepository;
import org.open4goods.commons.store.repository.elastic.ElasticProductRepository;
import org.open4goods.commons.store.repository.elastic.ElasticTextRepository;
import org.open4goods.ui.repository.ContributionVoteRepository;
import org.open4goods.ui.repository.UserSearchRepository;
import org.slf4j.Logger;
Expand All @@ -28,7 +29,7 @@
@EnableScheduling
@EnableCaching
@Configuration
@EnableElasticsearchRepositories(basePackageClasses = {ContributionVoteRepository.class, UserSearchRepository.class, ElasticProductRepository.class, BrandScoresRepository.class})
@EnableElasticsearchRepositories(basePackageClasses = {ContributionVoteRepository.class, UserSearchRepository.class, ElasticProductRepository.class, BrandScoresRepository.class, ElasticTextRepository.class})
//@EnableRedisRepositories(basePackageClasses = RedisProductRepository.class)
public class Ui {

Expand Down

0 comments on commit 10dd7e1

Please sign in to comment.