mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
SEARCH-409: Adding a Solr stats request
This commit is contained in:
@@ -193,6 +193,8 @@ public class SearchParameters implements BasicSearchParameters
|
||||
|
||||
private IntervalParameters interval;
|
||||
|
||||
private List<StatsRequestParameters> stats;
|
||||
|
||||
/**
|
||||
* Default constructor
|
||||
*/
|
||||
@@ -240,6 +242,7 @@ public class SearchParameters implements BasicSearchParameters
|
||||
sp.spellCheck = this.spellCheck;
|
||||
sp.highlight = this.highlight;
|
||||
sp.interval = this.interval;
|
||||
sp.stats = this.stats;
|
||||
return sp;
|
||||
}
|
||||
|
||||
@@ -295,6 +298,16 @@ public class SearchParameters implements BasicSearchParameters
|
||||
this.highlight = highlight;
|
||||
}
|
||||
|
||||
public List<StatsRequestParameters> getStats()
|
||||
{
|
||||
return stats;
|
||||
}
|
||||
|
||||
public void setStats(List<StatsRequestParameters> stats)
|
||||
{
|
||||
this.stats = stats;
|
||||
}
|
||||
|
||||
public IntervalParameters getInterval()
|
||||
{
|
||||
return interval;
|
||||
@@ -1277,10 +1290,12 @@ public class SearchParameters implements BasicSearchParameters
|
||||
.append(", queryTemplates=").append(this.queryTemplates).append(", namespace=")
|
||||
.append(this.namespace).append(", maxPermissionChecks=").append(this.maxPermissionChecks)
|
||||
.append(", maxPermissionCheckTimeMillis=").append(this.maxPermissionCheckTimeMillis)
|
||||
.append(", defaultFieldName=").append(this.defaultFieldName).append(", fieldFacets=")
|
||||
.append(this.fieldFacets).append(", facetQueries=").append(this.facetQueries)
|
||||
.append(this.filterQueries).append(", filterQueries=").append(this.filterQueries)
|
||||
.append(this.pivots).append(", pivots=").append(this.pivots)
|
||||
.append(", defaultFieldName=").append(this.defaultFieldName)
|
||||
.append(", fieldFacets=").append(this.fieldFacets)
|
||||
.append(", facetQueries=").append(this.facetQueries)
|
||||
.append(", filterQueries=").append(this.filterQueries)
|
||||
.append(", pivots=").append(this.pivots)
|
||||
.append(", stats=").append(this.stats)
|
||||
.append(", useInMemorySort=").append(this.useInMemorySort)
|
||||
.append(", maxRawResultSetSizeForInMemorySort=").append(this.maxRawResultSetSizeForInMemorySort)
|
||||
.append(", extraParameters=").append(this.extraParameters).append(", excludeTenantFilter=")
|
||||
|
@@ -0,0 +1,183 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Data model classes
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2017 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.service.cmr.search;
|
||||
|
||||
import org.codehaus.jackson.annotate.JsonCreator;
|
||||
import org.codehaus.jackson.annotate.JsonProperty;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* POJO class representing Stats request
|
||||
*/
|
||||
public class StatsRequestParameters
|
||||
{
|
||||
private final String field;
|
||||
private final String label;
|
||||
private final List<Float> percentiles;
|
||||
private final Boolean min;
|
||||
private final Boolean max;
|
||||
private final Boolean sum;
|
||||
private final Boolean count;
|
||||
private final Boolean missing;
|
||||
private final Boolean sumOfSquares;
|
||||
private final Boolean mean;
|
||||
private final Boolean stddev;
|
||||
private final Boolean distinctValues;
|
||||
private final Boolean countDistinct;
|
||||
private final Boolean cardinality;
|
||||
private final Float cardinalityAccuracy;
|
||||
private final List<String> excludeFilters;
|
||||
|
||||
@JsonCreator
|
||||
public StatsRequestParameters(
|
||||
@JsonProperty("field") String field,
|
||||
@JsonProperty("label") String label,
|
||||
@JsonProperty("percentiles") List<Float> percentiles,
|
||||
@JsonProperty("min") Boolean min,
|
||||
@JsonProperty("max") Boolean max,
|
||||
@JsonProperty("sum") Boolean sum,
|
||||
@JsonProperty("count") Boolean count,
|
||||
@JsonProperty("missing") Boolean missing,
|
||||
@JsonProperty("sumOfSquares") Boolean sumOfSquares,
|
||||
@JsonProperty("mean") Boolean mean,
|
||||
@JsonProperty("stddev") Boolean stddev,
|
||||
@JsonProperty("distinctValues") Boolean distinctValues,
|
||||
@JsonProperty("countDistinct") Boolean countDistinct,
|
||||
@JsonProperty("cardinality") Boolean cardinality,
|
||||
@JsonProperty("cardinalityAccuracy") Float cardinalityAccuracy,
|
||||
@JsonProperty("excludeFilters") List<String> excludeFilters)
|
||||
{
|
||||
this.field = field;
|
||||
this.label = label;
|
||||
this.percentiles = percentiles == null? Collections.emptyList():percentiles;
|
||||
|
||||
this.min = min == null?true:min;
|
||||
this.max = max == null?true:max;
|
||||
this.sum = sum == null?true:sum;
|
||||
this.count = count == null?true:count;
|
||||
this.missing = missing == null?true:missing;
|
||||
this.sumOfSquares = sumOfSquares == null?true:sumOfSquares;
|
||||
this.mean = mean == null?true:mean;
|
||||
this.stddev = stddev == null?true:stddev;
|
||||
|
||||
this.distinctValues = distinctValues == null?false:distinctValues;
|
||||
this.countDistinct = countDistinct == null?false:countDistinct;
|
||||
this.cardinality = cardinality == null?false:cardinality;
|
||||
this.cardinalityAccuracy = cardinalityAccuracy == null?0.3f:cardinalityAccuracy;
|
||||
this.excludeFilters = excludeFilters == null? Collections.emptyList():excludeFilters;
|
||||
}
|
||||
|
||||
public String getField()
|
||||
{
|
||||
return field;
|
||||
}
|
||||
|
||||
public String getLabel()
|
||||
{
|
||||
return label;
|
||||
}
|
||||
|
||||
public List<Float> getPercentiles()
|
||||
{
|
||||
return percentiles;
|
||||
}
|
||||
|
||||
public Boolean getDistinctValues()
|
||||
{
|
||||
return distinctValues;
|
||||
}
|
||||
|
||||
public Boolean getCountDistinct()
|
||||
{
|
||||
return countDistinct;
|
||||
}
|
||||
|
||||
public Boolean getCardinality()
|
||||
{
|
||||
return cardinality;
|
||||
}
|
||||
|
||||
public Float getCardinalityAccuracy()
|
||||
{
|
||||
return cardinalityAccuracy;
|
||||
}
|
||||
|
||||
public List<String> getExcludeFilters()
|
||||
{
|
||||
return excludeFilters;
|
||||
}
|
||||
|
||||
public Boolean getMin()
|
||||
{
|
||||
return min;
|
||||
}
|
||||
|
||||
public Boolean getMax()
|
||||
{
|
||||
return max;
|
||||
}
|
||||
|
||||
public Boolean getSum()
|
||||
{
|
||||
return sum;
|
||||
}
|
||||
|
||||
public Boolean getCount()
|
||||
{
|
||||
return count;
|
||||
}
|
||||
|
||||
public Boolean getMissing()
|
||||
{
|
||||
return missing;
|
||||
}
|
||||
|
||||
public Boolean getSumOfSquares()
|
||||
{
|
||||
return sumOfSquares;
|
||||
}
|
||||
|
||||
public Boolean getMean()
|
||||
{
|
||||
return mean;
|
||||
}
|
||||
|
||||
public Boolean getStddev()
|
||||
{
|
||||
return stddev;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "StatsRequestParameters{" + "field='" + field + '\'' + ", label='" + label + '\'' + ", percentiles=" + percentiles + ", min=" + min
|
||||
+ ", max=" + max + ", sum=" + sum + ", count=" + count + ", missing=" + missing + ", sumOfSquares=" + sumOfSquares + ", mean="
|
||||
+ mean + ", stddev=" + stddev + ", distinctValues=" + distinctValues + ", countDistinct=" + countDistinct + ", cardinality="
|
||||
+ cardinality + ", cardinalityAccuracy=" + cardinalityAccuracy + ", excludeFilters=" + excludeFilters + '}';
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user