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

@@ -0,0 +1,82 @@
/*-
* #%L
* alfresco-tas-restapi
* %%
* Copyright (C) 2005 - 2023 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
package org.alfresco.rest.search;
import org.alfresco.rest.core.IRestModel;
import org.alfresco.utility.model.TestModel;
import com.fasterxml.jackson.annotation.JsonProperty;
public class RestRequestLimitsModel extends TestModel implements IRestModel<RestRequestLimitsModel>
{
@JsonProperty
RestRequestLimitsModel model;
private Integer permissionEvaluationTime;
private Integer permissionEvaluationCount;
private Integer trackTotalHitsLimit;
@Override
public RestRequestLimitsModel onModel()
{
return model;
}
public RestRequestLimitsModel(Integer permissionEvaluationTime, Integer permissionEvaluationCount,
Integer trackTotalHitsLimit)
{
super();
this.permissionEvaluationTime = permissionEvaluationTime;
this.permissionEvaluationCount = permissionEvaluationCount;
this.trackTotalHitsLimit = trackTotalHitsLimit;
}
public Integer getPermissionEvaluationTime()
{
return permissionEvaluationTime;
}
public void setPermissionEvaluationTime(Integer permissionEvaluationTime)
{
this.permissionEvaluationTime = permissionEvaluationTime;
}
public Integer getPermissionEvaluationCount()
{
return permissionEvaluationCount;
}
public void setPermissionEvaluationCount(Integer permissionEvaluationCount)
{
this.permissionEvaluationCount = permissionEvaluationCount;
}
public Integer getTrackTotalHitsLimit()
{
return trackTotalHitsLimit;
}
public void setTrackTotalHitsLimit(Integer trackTotalHitsLimit)
{
this.trackTotalHitsLimit = trackTotalHitsLimit;
}
}

View File

@@ -79,6 +79,7 @@ public class SearchRequest extends TestModel
List<SortClause> sort;
RestRequestDefaultsModel defaults;
List<RestRequestTemplatesModel> templates;
RestRequestLimitsModel limits;
public SearchRequest()
{
@@ -302,4 +303,15 @@ public class SearchRequest extends TestModel
return this;
}
public RestRequestLimitsModel getLimits()
{
return limits;
}
public void setLimits(RestRequestLimitsModel limits)
{
this.limits = limits;
}
}