Merged 5.2.N (5.2.1) to HEAD (5.2)

130306 gjames: Merged searchapi (5.2.1) to 5.2.N (5.2.1)
      130147 gjames: SEARCH-121: Implementing facet fields


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@130378 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Alan Davis
2016-09-06 22:11:48 +00:00
parent 16e360f955
commit 0a37f5da26
8 changed files with 153 additions and 19 deletions

View File

@@ -0,0 +1,75 @@
/*-
* #%L
* Alfresco Remote API
* %%
* Copyright (C) 2005 - 2016 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.api.search.context;
import java.util.List;
/**
* The results of a Field Facetting
*/
public class FacetFieldContext
{
private final String label;
private final List<Bucket> buckets;
public FacetFieldContext(String label, List<Bucket> buckets)
{
this.label = label;
this.buckets = buckets;
}
public String getLabel()
{
return label;
}
public List<Bucket> getBuckets()
{
return buckets;
}
public static class Bucket
{
private final String label;
private final int count;
public Bucket(String label, int count)
{
this.label = label;
this.count = count;
}
public String getLabel()
{
return label;
}
public int getCount()
{
return count;
}
}
}

View File

@@ -35,8 +35,9 @@ public class SearchContext
private final Consistency consistency;
private final List<FacetQueryContext> facetQueries;
private final SpellCheckContext spellCheck;
private final FacetFieldContext facetsFields;
public SearchContext(long lastTxId, List<FacetQueryContext> facetQueries, SpellCheckContext spellCheck)
public SearchContext(long lastTxId, List<FacetQueryContext> facetQueries, FacetFieldContext facetsFields, SpellCheckContext spellCheck)
{
this.spellCheck = spellCheck;
if (lastTxId > 0)
@@ -48,6 +49,7 @@ public class SearchContext
consistency = null;
}
this.facetQueries = facetQueries;
this.facetsFields = facetsFields;
}
public Consistency getConsistency()
@@ -65,6 +67,11 @@ public class SearchContext
return spellCheck;
}
public FacetFieldContext getFacetsFields()
{
return facetsFields;
}
public class Consistency
{
private final long lastTxId;