diff --git a/README.md b/README.md index 59f4f6165..a5f5edfd4 100644 --- a/README.md +++ b/README.md @@ -166,6 +166,67 @@ Indexing multiple Document(bulk index) using Repository repository.save(sampleEntities); ``` +### Adding custom behaviors to ResultMapper - CustomResultMapper + +Define new class implementing ResultMapper + +```java +public class CustomResultMapper implements ResultsMapper{ + + private EntityMapper entityMapper; + + public CustomResultMapper(EntityMapper entityMapper) { + this.entityMapper = entityMapper; + } + + @Override + public EntityMapper getEntityMapper() { + return entityMapper; + } + + @Override + public T mapResult(GetResponse response, Class clazz) { + return null; //Your implementation + } + + @Override + public FacetedPage mapResults(SearchResponse response, Class clazz, Pageable pageable) { + return null; //Your implementation + } +} + +``` + +Inject your custom implementation to template + + +```xml + + + + + + + + + + + + + + + + + + + +``` + ### Geo indexing and request You can make request using geo_distance filter. This can be done using GeoPoint object. diff --git a/src/test/java/org/springframework/data/elasticsearch/core/CustomResultMapper.java b/src/test/java/org/springframework/data/elasticsearch/core/CustomResultMapper.java index e2676fa9a..dc531b577 100644 --- a/src/test/java/org/springframework/data/elasticsearch/core/CustomResultMapper.java +++ b/src/test/java/org/springframework/data/elasticsearch/core/CustomResultMapper.java @@ -5,9 +5,7 @@ import org.elasticsearch.action.search.SearchResponse; import org.springframework.data.domain.Pageable; /** - * User: dead - * Date: 11/11/13 - * Time: 17:37 + * @author Artur Konczak */ public class CustomResultMapper implements ResultsMapper{