mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
Merged 5.2.N (5.2.2) to HEAD (5.2)
136080 gjames: Merged searchbcr (5.2.1) to 5.2.N (5.2.1) 135510 gjames: SEARCH-372: Adding filterQuery to the result, wip git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@137452 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -54,16 +54,23 @@ public class FacetFieldContext
|
||||
public static class Bucket
|
||||
{
|
||||
private final String label;
|
||||
private final String filterQuery;
|
||||
private final int count;
|
||||
private final Object display;
|
||||
|
||||
public Bucket(String label, int count, Object display)
|
||||
public Bucket(String label, String filterQuery, int count, Object display)
|
||||
{
|
||||
this.label = label;
|
||||
this.filterQuery = filterQuery;
|
||||
this.count = count;
|
||||
this.display = display;
|
||||
}
|
||||
|
||||
public String getFilterQuery()
|
||||
{
|
||||
return filterQuery;
|
||||
}
|
||||
|
||||
public Object getDisplay()
|
||||
{
|
||||
return display;
|
||||
@@ -78,5 +85,48 @@ public class FacetFieldContext
|
||||
{
|
||||
return count;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o)
|
||||
{
|
||||
if (this == o)
|
||||
return true;
|
||||
if (o == null || getClass() != o.getClass())
|
||||
return false;
|
||||
|
||||
Bucket bucket = (Bucket) o;
|
||||
|
||||
if (count != bucket.count)
|
||||
return false;
|
||||
if (label != null ? !label.equals(bucket.label) : bucket.label != null)
|
||||
return false;
|
||||
if (filterQuery != null ? !filterQuery.equals(bucket.filterQuery) : bucket.filterQuery != null)
|
||||
return false;
|
||||
if (display != null ? !display.equals(bucket.display) : bucket.display != null)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
int result = label != null ? label.hashCode() : 0;
|
||||
result = 31 * result + (filterQuery != null ? filterQuery.hashCode() : 0);
|
||||
result = 31 * result + count;
|
||||
result = 31 * result + (display != null ? display.hashCode() : 0);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "Bucket{" +
|
||||
"label='" + label + '\'' +
|
||||
", filterQuery='" + filterQuery + '\'' +
|
||||
", count=" + count +
|
||||
", display=" + display +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -31,14 +31,21 @@ package org.alfresco.rest.api.search.context;
|
||||
public class FacetQueryContext
|
||||
{
|
||||
private final String label;
|
||||
private final String filterQuery;
|
||||
private final int count;
|
||||
|
||||
public FacetQueryContext(String label, int count)
|
||||
public FacetQueryContext(String label, String filterQuery, int count)
|
||||
{
|
||||
this.label = label;
|
||||
this.filterQuery = filterQuery;
|
||||
this.count = count;
|
||||
}
|
||||
|
||||
public String getFilterQuery()
|
||||
{
|
||||
return filterQuery;
|
||||
}
|
||||
|
||||
public String getLabel()
|
||||
{
|
||||
return label;
|
||||
@@ -48,4 +55,43 @@ public class FacetQueryContext
|
||||
{
|
||||
return count;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o)
|
||||
{
|
||||
if (this == o)
|
||||
return true;
|
||||
if (o == null || getClass() != o.getClass())
|
||||
return false;
|
||||
|
||||
FacetQueryContext that = (FacetQueryContext) o;
|
||||
|
||||
if (count != that.count)
|
||||
return false;
|
||||
if (label != null ? !label.equals(that.label) : that.label != null)
|
||||
return false;
|
||||
if (filterQuery != null ? !filterQuery.equals(that.filterQuery) : that.filterQuery != null)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
int result = label != null ? label.hashCode() : 0;
|
||||
result = 31 * result + (filterQuery != null ? filterQuery.hashCode() : 0);
|
||||
result = 31 * result + count;
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "FacetQueryContext{" +
|
||||
"label='" + label + '\'' +
|
||||
", filterQuery='" + filterQuery + '\'' +
|
||||
", count=" + count +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
@@ -276,7 +276,7 @@ public class ResultMapper
|
||||
facetResults = new ArrayList<>(facetQueries.size());
|
||||
for (Entry<String, Integer> fq:facetQueries.entrySet())
|
||||
{
|
||||
facetResults.add(new FacetQueryContext(fq.getKey(), fq.getValue()));
|
||||
facetResults.add(new FacetQueryContext(fq.getKey(), ":NOT_DONE", fq.getValue()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -312,7 +312,7 @@ public class ResultMapper
|
||||
for (Pair<String, Integer> buck:facet.getValue())
|
||||
{
|
||||
Object display = withDisplay?propertyLookup.lookup(facet.getKey(), buck.getFirst()):null;
|
||||
buckets.add(new Bucket(buck.getFirst(), buck.getSecond(), display));
|
||||
buckets.add(new Bucket(buck.getFirst(), facet.getKey()+":NOT_DONE", buck.getSecond(), display));
|
||||
}
|
||||
ffcs.add(new FacetFieldContext(facet.getKey(), buckets));
|
||||
}
|
||||
|
Reference in New Issue
Block a user