-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create index field mapping aliases (#102)
* update proto for field aliases * add field mapping aliases
- Loading branch information
Showing
10 changed files
with
332 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
zulia-client/src/main/java/io/zulia/client/command/builder/FieldMapping.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package io.zulia.client.command.builder; | ||
|
||
import io.zulia.message.ZuliaIndex; | ||
|
||
import java.util.LinkedHashSet; | ||
import java.util.Set; | ||
|
||
public class FieldMapping implements FieldMappingBuilder { | ||
|
||
private final String alias; | ||
private final Set<String> fields; | ||
private boolean includeSelf; | ||
|
||
public FieldMapping(String alias) { | ||
this.alias = alias; | ||
this.fields = new LinkedHashSet<>(); | ||
} | ||
|
||
public FieldMapping addMappedFields(String... fieldOrFieldPatterns) { | ||
for (String fieldOrFieldPattern : fieldOrFieldPatterns) { | ||
fields.add(fieldOrFieldPattern); | ||
} | ||
return this; | ||
} | ||
|
||
public FieldMapping includeSelf() { | ||
this.includeSelf = true; | ||
return this; | ||
} | ||
|
||
public FieldMapping excludeSelf() { | ||
this.includeSelf = false; | ||
return this; | ||
} | ||
|
||
@Override | ||
public ZuliaIndex.FieldMapping getFieldMapping() { | ||
return ZuliaIndex.FieldMapping.newBuilder().setAlias(alias).addAllFieldOrFieldPattern(fields).setIncludeSelf(includeSelf).build(); | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
zulia-client/src/main/java/io/zulia/client/command/builder/FieldMappingBuilder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package io.zulia.client.command.builder; | ||
|
||
import io.zulia.message.ZuliaIndex.FieldMapping; | ||
|
||
public interface FieldMappingBuilder { | ||
|
||
FieldMapping getFieldMapping(); | ||
} |
Oops, something went wrong.