private static final Double[] LINES_THRESHOLDS = new Double[] {1_000d, 10_000d, 100_000d, 500_000d};
private static final Double[] COVERAGE_THRESHOLDS = new Double[] {30d, 50d, 70d, 80d};
private static final Double[] DUPLICATIONS_THRESHOLDS = new Double[] {3d, 5d, 10d, 20d};
-
+
private static final String FIELD_MEASURES_KEY = FIELD_MEASURES + "." + ProjectMeasuresIndexDefinition.FIELD_MEASURES_KEY;
private static final String FIELD_MEASURES_VALUE = FIELD_MEASURES + "." + ProjectMeasuresIndexDefinition.FIELD_MEASURES_VALUE;
}
}
- public List<String> searchTags(@Nullable String textQuery, int pageSize) {
- checkArgument(pageSize <= 100, "Page size must be lower than or equals to " + 100);
- if (pageSize == 0) {
+ public List<String> searchTags(@Nullable String textQuery, int size) {
+ int maxPageSize = 500;
+ checkArgument(size <= maxPageSize, "Page size must be lower than or equals to " + maxPageSize);
+ if (size <= 0) {
return emptyList();
}
TermsBuilder tagFacet = AggregationBuilders.terms(FIELD_TAGS)
.field(FIELD_TAGS)
- .size(pageSize)
+ .size(size)
.minDocCount(1)
.order(Terms.Order.term(true));
if (textQuery != null) {
}
@Test
- public void facet_tags_size_limited_to_10() {
+ public void facet_tags_returns_10_elements_by_default() {
index(
newDoc().setTags(newArrayList("finance1", "finance2", "finance3", "finance4", "finance5", "finance6", "finance7", "finance8", "finance9", "finance10")),
newDoc().setTags(newArrayList("finance1", "finance2", "finance3", "finance4", "finance5", "finance6", "finance7", "finance8", "finance9", "finance10")),
}
@Test
- public void fail_if_page_size_greater_than_100() {
+ public void fail_if_page_size_greater_than_500() {
expectedException.expect(IllegalArgumentException.class);
- expectedException.expectMessage("Page size must be lower than or equals to 100");
+ expectedException.expectMessage("Page size must be lower than or equals to 500");
- underTest.searchTags("whatever", 101);
+ underTest.searchTags("whatever", 501);
}
private void index(ProjectMeasuresDoc... docs) {