ACS-5487 - Track Total Hits on ES (#2041)

SearchParameters - added trackTotalHits (int) attribute
SearchRequest - Added trackTotalHitsLimit (int) to the Limits attribute and mapped it to the SearchParameters
Changed the SearchRequest model in TAS to include a new RestRequestLimitsModel that has the new trackTotalHitsLimit attribute
SearchMapperTests to test the changes in the SearchParameters
This commit is contained in:
evasques
2023-07-05 15:39:36 +01:00
committed by GitHub
parent d372ff6f5e
commit a1faf97fc5
6 changed files with 173 additions and 22 deletions

View File

@@ -201,6 +201,11 @@ public class SearchParameters implements BasicSearchParameters
private String timezone;
/**
* Configure the limit to track the total hits on search results
*/
private int trackTotalHits;
/**
* Default constructor
*/
@@ -251,6 +256,7 @@ public class SearchParameters implements BasicSearchParameters
sp.stats = this.stats;
sp.ranges = this.ranges;
sp.timezone = this.timezone;
sp.trackTotalHits = this.trackTotalHits;
return sp;
}
@@ -1641,6 +1647,21 @@ public class SearchParameters implements BasicSearchParameters
{
this.includeMetadata = includeMetadata;
}
public int getTrackTotalHits()
{
return trackTotalHits;
}
/**
* Set a maximum value for the report of total hits. The reported number of hits will never exceed this limit even
* if more are found. If unset, the engines default tracking limit is applied. To remove any limit, set to -1.
*
* @param trackTotalHits int
*/
public void setTrackTotalHits(int trackTotalHits)
{
this.trackTotalHits = trackTotalHits;
}
}