This issue has been created
 
 
XWiki Platform / cid:jira-generated-image-avatar-9be97463-1d82-47a7-952b-53a66d7d76c3 XWIKI-24864 Open

Active Installs searchInstalls() returns at most 10 pings while its javadoc promises all of them

 
View issue   ·   Add comment
 

Issue created

 
cid:jira-generated-image-avatar-5c75715e-7161-4d78-afe7-ad5c14abe830 Vincent Massol created this issue on 11/Sep/26 10:20
 
Summary: Active Installs searchInstalls() returns at most 10 pings while its javadoc promises all of them
Issue Type: cid:jira-generated-image-avatar-9be97463-1d82-47a7-952b-53a66d7d76c3 Bug
Affects Versions: 14.4
Assignee: Unassigned
Components: Active Installs
Created: 11/Sep/26 10:20
Priority: cid:jira-generated-image-static-major-40d225e9-6bb3-4e3a-99d5-915a49636806 Major
Reporter: Vincent Massol
Description:

DataManager#searchInstalls(String) is documented as returning all matching pings, but DefaultDataManager never sets the search request's size, so Elasticsearch applies its default of 10 hits. The method therefore returns at most 10 pings, however many the query matches.

The javadoc (DataManager.java):

 * @return the parsed JSON result coming from Elastic Search, as a list of {@link Ping} object. Passing an empty
 *      or null json string results in returning all data found in the index (i.e no query constraint)

The implementation (DefaultDataManager.java):

SearchRequest request = SearchRequest.of(s -> {
    s.index(ElasticsearchClientManager.INDEX);
    return applyQuery(s, jsonQuery);
});

There is no size(...) call, and there has never been one: the method has been this way since it was introduced in 14.4RC1 (commit 7a8d0ea6e71, 2022-05-10).

Note that countInstalls and the two 18.8.0RC1 methods (countDistinctInstalls, countDistinctInstallsByExtension) are unaffected — they aggregate rather than return hits.

This also makes the documentation wrong. Active Installs Script Service says "Pass an empty string to select every ping", which is true for the counting methods but not for searchInstalls.

What needs deciding:

  • set an explicit size (and, for result sets that can be large, paginate with search_after or a PIT rather than raising the cap indefinitely); or
  • keep a cap deliberately, and fix the javadoc and the reference page to state it.

Found while documenting XWIKI-24710 for the 18.8.0RC1 release notes.