Skip to content

Commit 1ce49f6

Browse files
author
Luc Boutier
committed
Version 1.5.2.
1 parent bdaed90 commit 1ce49f6

File tree

5 files changed

+21
-3
lines changed

5 files changed

+21
-3
lines changed

elasticsearch-annotations/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<parent>
55
<groupId>org.alien4cloud</groupId>
66
<artifactId>elasticsearch-mapping-parent</artifactId>
7-
<version>1.6.0-SNAPSHOT</version>
7+
<version>1.5.2</version>
88
</parent>
99

1010
<artifactId>elasticsearch-annotations</artifactId>

elasticsearch-annotations/src/main/java/org/elasticsearch/annotation/query/TermFilter.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,11 @@
1616
@Target({ ElementType.FIELD, ElementType.METHOD })
1717
public @interface TermFilter {
1818
String[] paths() default "";
19+
20+
/**
21+
* Optional paths generator to override the paths property of the annotation for complex use-case or reflection etc.
22+
*
23+
* @return the path generator.
24+
*/
25+
Class<? extends IPathGenerator> pathGenerator() default IPathGenerator.DEFAULT.class;
1926
}

elasticsearch-mapping/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<parent>
44
<groupId>org.alien4cloud</groupId>
55
<artifactId>elasticsearch-mapping-parent</artifactId>
6-
<version>1.6.0-SNAPSHOT</version>
6+
<version>1.5.2</version>
77
</parent>
88

99
<artifactId>elasticsearch-mapping</artifactId>

elasticsearch-mapping/src/main/java/org/elasticsearch/mapping/FieldsMappingBuilder.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,17 @@ private void processFilterAnnotation(List<IFilterBuilderHelper> classFilters, St
211211
TermFilter termFilter = indexable.getAnnotation(TermFilter.class);
212212
if (termFilter != null) {
213213
String[] paths = termFilter.paths();
214+
if (termFilter.pathGenerator() != null) {
215+
// create an instance of the generator
216+
try {
217+
IPathGenerator generator = termFilter.pathGenerator().newInstance();
218+
paths = generator.getPaths(paths);
219+
} catch (InstantiationException e) {
220+
e.printStackTrace(); // TODO better exception handling
221+
} catch (IllegalAccessException e) {
222+
e.printStackTrace(); // TODO better exception handling
223+
}
224+
}
214225
for (String path : paths) {
215226
path = path.trim();
216227
boolean isAnalyzed = isAnalyzed(indexable);

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<modelVersion>4.0.0</modelVersion>
44
<groupId>org.alien4cloud</groupId>
55
<artifactId>elasticsearch-mapping-parent</artifactId>
6-
<version>1.6.0-SNAPSHOT</version>
6+
<version>1.5.2</version>
77
<packaging>pom</packaging>
88

99
<name>Elastic search mapping parent</name>

0 commit comments

Comments
 (0)