Commit 64f6f7c1 authored by Matija Obreza's avatar Matija Obreza

ES: Date serialization

parent dca03d2c
......@@ -486,12 +486,12 @@
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-elasticsearch</artifactId>
<version>3.2.6.RELEASE</version>
<version>3.2.7.RELEASE</version>
</dependency>
<dependency>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch</artifactId>
<version>6.8.7</version>
<version>6.8.8</version>
</dependency>
<dependency>
......
......@@ -78,6 +78,7 @@ import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.MapperFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.databind.util.StdDateFormat;
import com.fasterxml.jackson.datatype.hibernate5.Hibernate5Module;
import com.fasterxml.jackson.datatype.hibernate5.Hibernate5Module.Feature;
import com.hazelcast.core.HazelcastInstance;
......@@ -288,6 +289,10 @@ public class ElasticsearchConfig extends ElasticsearchConfigurationSupport {
mapper.enable(MapperFeature.DEFAULT_VIEW_INCLUSION);
mapper.setAnnotationIntrospector(new ElasticJacksonAnnotationIntrospector());
mapper.writerWithView(JsonViews.Indexed.class);
// JSON Dates
mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
mapper.setDateFormat(new StdDateFormat().withColonInTimeZone(true));
}
@Override
......
......@@ -41,7 +41,6 @@ import org.genesys2.server.service.ElasticsearchService;
import org.genesys2.server.service.ElasticsearchService.TermResult;
import org.genesys2.server.service.InstituteService;
import org.genesys2.server.service.filter.AccessionFilter;
import org.genesys2.server.service.filter.InstituteFilter;
import org.genesys2.server.service.impl.SearchException;
import org.genesys2.server.service.worker.AccessionUploader;
import org.junit.Before;
......@@ -310,6 +309,14 @@ public class ElasticQueryBuilderTest extends AbstractElasticServiceTest {
assertThat(search.size(), is(0));
}
@Test
public void testFulltext() throws SearchException {
AccessionFilter af = new AccessionFilter();
af._text = "Musa";
List<Accession> search = elasticsearchService.find(Accession.class, af);
assertThat(search.size(), is(2));
}
/**
* Test that removing documents from index
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment