Search-340, adding new range model for faceted search

This commit is contained in:
Michael Suzuki
2017-05-09 14:37:13 +01:00
parent 3971ae3fa2
commit a6586ffe90
2 changed files with 157 additions and 0 deletions

View File

@@ -0,0 +1,143 @@
/*
* #%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 java.util.List;
import org.alfresco.api.AlfrescoPublicApi;
import org.codehaus.jackson.annotate.JsonCreator;
import org.codehaus.jackson.annotate.JsonProperty;
/**
* Parameters used for search range.
*/
@AlfrescoPublicApi
public class RangeParameters
{
private String field;
private int minCount;
private String start;
private String end;
private String gap;
private boolean hardend;
private String other;
private String include;
private List<String> tags;
private List<String> excludeFilters;
public RangeParameters() {}
@JsonCreator
public RangeParameters( @JsonProperty("field") String field,
@JsonProperty("facet.range.start") String start,
@JsonProperty("facet.range.end") String end,
@JsonProperty("facet.range.gap") String gap)
{
super();
this.field = field;
this.start = start;
this.end = end;
this.gap = gap;
this.hardend = false;
}
/**
* Constructor.
* @param field
* @param minCount
* @param start
* @param end
* @param gap
* @param hardend
* @param other
* @param include
* @param tags
* @param excludeFilters
*/
public RangeParameters(String field,
int minCount,
String start,
String end,
String gap,
boolean hardend,
String other,
String include,
List<String> tags,
List<String> excludeFilters)
{
super();
this.field = field;
this.minCount = minCount;
this.start = start;
this.end = end;
this.gap = gap;
this.hardend = hardend;
this.other = other;
this.include = include;
this.tags = tags;
this.excludeFilters = excludeFilters;
}
public String getField()
{
return field;
}
public int getMinCount()
{
return minCount;
}
public String getStart()
{
return start;
}
public String getEnd()
{
return end;
}
public String getGap()
{
return gap;
}
public boolean isHardend()
{
return hardend;
}
public String getOther()
{
return other;
}
public String getInclude()
{
return include;
}
public List<String> getTags()
{
return tags;
}
public List<String> getExcludeFilters()
{
return excludeFilters;
}
}

View File

@@ -194,6 +194,8 @@ public class SearchParameters implements BasicSearchParameters
private IntervalParameters interval;
private List<StatsRequestParameters> stats;
private RangeParameters range;
/**
* Default constructor
@@ -243,6 +245,7 @@ public class SearchParameters implements BasicSearchParameters
sp.highlight = this.highlight;
sp.interval = this.interval;
sp.stats = this.stats;
sp.range = this.range;
return sp;
}
@@ -322,6 +325,16 @@ public class SearchParameters implements BasicSearchParameters
this.interval = interval;
}
public RangeParameters getRange()
{
return range;
}
public void setRange(RangeParameters range)
{
this.range = range;
}
/**
* Set the query language.
*
@@ -1304,6 +1317,7 @@ public class SearchParameters implements BasicSearchParameters
.append(this.sinceTxId).append(", searchTerm=").append(this.searchTerm)
.append(", highlight=").append(this.highlight)
.append(", interval=").append(this.interval)
.append(", range=").append(this.range)
.append(", spellCheck=").append(this.spellCheck).append("]");
return builder.toString();
}