-
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.
Merge pull request #47 from zuliaio/stats
Stats
- Loading branch information
Showing
16 changed files
with
1,369 additions
and
345 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
17 changes: 17 additions & 0 deletions
17
zulia-client/src/main/java/io/zulia/client/command/builder/NumericStat.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,17 @@ | ||
package io.zulia.client.command.builder; | ||
|
||
import io.zulia.message.ZuliaQuery.StatRequest; | ||
|
||
public class NumericStat implements StatBuilder { | ||
|
||
private final StatRequest.Builder statRequestBuilder; | ||
|
||
public NumericStat(String numericField) { | ||
statRequestBuilder = StatRequest.newBuilder().setNumericField(numericField); | ||
} | ||
|
||
@Override | ||
public StatRequest getStatRequest() { | ||
return statRequestBuilder.build(); | ||
} | ||
} |
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
8 changes: 8 additions & 0 deletions
8
zulia-client/src/main/java/io/zulia/client/command/builder/StatBuilder.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.ZuliaQuery; | ||
|
||
public interface StatBuilder { | ||
|
||
ZuliaQuery.StatRequest getStatRequest(); | ||
} |
39 changes: 39 additions & 0 deletions
39
zulia-client/src/main/java/io/zulia/client/command/builder/StatFacet.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,39 @@ | ||
package io.zulia.client.command.builder; | ||
|
||
import io.zulia.message.ZuliaQuery; | ||
import io.zulia.message.ZuliaQuery.StatRequest; | ||
|
||
import java.util.Arrays; | ||
|
||
public class StatFacet implements StatBuilder { | ||
|
||
private final StatRequest.Builder statRequestBuilder; | ||
|
||
public StatFacet(String numericField, String facetField) { | ||
statRequestBuilder = StatRequest.newBuilder().setNumericField(numericField).setFacetField(ZuliaQuery.Facet.newBuilder().setLabel(facetField).build()); | ||
} | ||
|
||
public StatFacet(String numericField, String facetField, String... path) { | ||
this(numericField, facetField, Arrays.asList(path)); | ||
} | ||
|
||
public StatFacet(String numericField, String facetField, Iterable<String> path) { | ||
statRequestBuilder = StatRequest.newBuilder().setNumericField(numericField) | ||
.setFacetField(ZuliaQuery.Facet.newBuilder().setLabel(facetField).addAllPath(path).build()); | ||
} | ||
|
||
public StatFacet setTopN(int topN) { | ||
statRequestBuilder.setMaxFacets(topN); | ||
return this; | ||
} | ||
|
||
public StatFacet setTopNShard(int topNShard) { | ||
statRequestBuilder.setShardFacets(topNShard); | ||
return this; | ||
} | ||
|
||
@Override | ||
public StatRequest getStatRequest() { | ||
return statRequestBuilder.build(); | ||
} | ||
} |
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
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
Oops, something went wrong.