|
25 | 25 | import org.apache.lucene.index.Term;
|
26 | 26 | import org.apache.lucene.queryparser.classic.ParseException;
|
27 | 27 | import org.apache.lucene.search.Query;
|
| 28 | +import org.apache.lucene.util.BytesRef; |
28 | 29 | import org.hibernate.validator.constraints.NotBlank;
|
29 | 30 | import org.opengrok.suggest.LookupResultItem;
|
30 | 31 | import org.opengrok.suggest.Suggester.Suggestions;
|
@@ -187,7 +188,7 @@ public void addSearchCountsQueries(final List<String> urls) {
|
187 | 188 | continue;
|
188 | 189 | }
|
189 | 190 | if (fieldQueryText.size() > 2) {
|
190 |
| - logger.log(Level.WARNING, "Bad format, ignoring"); |
| 191 | + logger.log(Level.WARNING, "Bad format, ignoring {0}", urlStr); |
191 | 192 | continue;
|
192 | 193 | }
|
193 | 194 | String value = fieldQueryText.get(0);
|
@@ -267,9 +268,16 @@ public List<Entry<String, Integer>> getPopularityDataPaged(
|
267 | 268 | @PathParam("project") final String project,
|
268 | 269 | @QueryParam("field") @DefaultValue(QueryBuilder.FULL) final String field,
|
269 | 270 | @QueryParam("page") @DefaultValue("" + 0) final int page,
|
270 |
| - @QueryParam("pageSize") @DefaultValue("" + POPULARITY_DEFAULT_PAGE_SIZE) final int pageSize |
| 271 | + @QueryParam("pageSize") @DefaultValue("" + POPULARITY_DEFAULT_PAGE_SIZE) final int pageSize, |
| 272 | + @QueryParam("all") final boolean all |
271 | 273 | ) {
|
272 |
| - return suggester.getPopularityData(project, field, page, pageSize).stream() |
| 274 | + List<Entry<BytesRef, Integer>> data; |
| 275 | + if (all) { |
| 276 | + data = suggester.getPopularityData(project, field, 0, Integer.MAX_VALUE); |
| 277 | + } else { |
| 278 | + data = suggester.getPopularityData(project, field, page, pageSize); |
| 279 | + } |
| 280 | + return data.stream() |
273 | 281 | .map(e -> new SimpleEntry<>(e.getKey().utf8ToString(), e.getValue()))
|
274 | 282 | .collect(Collectors.toList());
|
275 | 283 | }
|
|
0 commit comments