@@ -45,7 +45,7 @@ public class GroupOptions {
45
45
46
46
private boolean truncateFacets = false ;
47
47
private boolean groupFacets = false ;
48
- private boolean groupCount = false ;
48
+ private boolean totalCount = false ;
49
49
private boolean groupMain = false ;
50
50
private int cachePercent = DEFAULT_CACHE_PERCENT ;
51
51
@@ -135,23 +135,23 @@ public List<Query> getGroupByQueries() {
135
135
* @param offset
136
136
* @return
137
137
*/
138
- public GroupOptions setGroupOffset (Integer offset ) {
138
+ public GroupOptions setOffset (Integer offset ) {
139
139
140
- this .offset = offset ;
140
+ this .offset = offset == null ? null : Math . max ( 0 , offset ) ;
141
141
return this ;
142
142
}
143
143
144
144
/**
145
145
* @return initial offset of each group
146
146
*/
147
- public Integer getGroupOffset () {
147
+ public Integer getOffset () {
148
148
return offset ;
149
149
}
150
150
151
151
/**
152
152
* @return the number of rows to return for each group.
153
153
*/
154
- public Integer getGroupRows () {
154
+ public Integer getLimit () {
155
155
return limit ;
156
156
}
157
157
@@ -161,7 +161,7 @@ public Integer getGroupRows() {
161
161
* @param limit
162
162
* @return
163
163
*/
164
- public GroupOptions setGroupLimit (Integer limit ) {
164
+ public GroupOptions setLimit (Integer limit ) {
165
165
166
166
this .limit = limit ;
167
167
return this ;
@@ -201,17 +201,17 @@ public Sort getSort() {
201
201
* @param groupCount
202
202
* @return
203
203
*/
204
- public GroupOptions setGroupTotalCount (boolean groupCount ) {
204
+ public GroupOptions setTotalCount (boolean groupCount ) {
205
205
206
- this .groupCount = groupCount ;
206
+ this .totalCount = groupCount ;
207
207
return this ;
208
208
}
209
209
210
210
/**
211
211
* @return whether the group count should be included in the response.
212
212
*/
213
- public boolean isGroupTotalCount () {
214
- return groupCount ;
213
+ public boolean isTotalCount () {
214
+ return totalCount ;
215
215
}
216
216
217
217
/**
@@ -222,7 +222,7 @@ public boolean isGroupTotalCount() {
222
222
*/
223
223
public GroupOptions setCachePercent (int cachePercent ) {
224
224
225
- this .cachePercent = cachePercent ;
225
+ this .cachePercent = Math . max ( 0 , Math . min ( 100 , cachePercent )) ;
226
226
return this ;
227
227
}
228
228
@@ -255,7 +255,7 @@ public boolean isTruncateFacets() {
255
255
/**
256
256
* Defines whether field facet shall be computed in grouped fashion.
257
257
*
258
- * @param truncateFacets
258
+ * @param groupFacets
259
259
* @return
260
260
*/
261
261
public GroupOptions setGroupFacets (boolean groupFacets ) {
@@ -290,16 +290,16 @@ public boolean isGroupMain() {
290
290
return groupMain ;
291
291
}
292
292
293
- public Pageable getGroupPageRequest () {
293
+ public Pageable getPageRequest () {
294
294
295
295
if (this .limit == null && this .offset == null ) {
296
296
return null ;
297
297
}
298
298
299
- int rows = this .limit != null ? this .limit : DEFAULT_GROUP_LIMIT ;
299
+ int limit = this .limit != null ? this .limit : DEFAULT_GROUP_LIMIT ;
300
300
int offset = this .offset != null ? this .offset : 0 ;
301
301
302
- return new SolrPageRequest (rows != 0 ? offset / rows : 0 , rows , this .sort );
302
+ return new SolrPageRequest (limit != 0 ? offset / limit : 0 , limit , this .sort );
303
303
}
304
304
305
305
}
0 commit comments