mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
Merged searchrep (5.2.1) to 5.2.N (5.2.1)
136645 gjames: SEARCH-409: Better pivot with stats handling git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@137036 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -524,40 +524,43 @@ public class SearchMapper
|
||||
Pivot pivot = piterator.next();
|
||||
ParameterCheck.mandatoryString("pivot key", pivot.getKey());
|
||||
String pivotKey = pivot.getKey();
|
||||
|
||||
if (facetFields.getFacets() != null && !facetFields.getFacets().isEmpty())
|
||||
{
|
||||
Optional<FacetField> found = facetFields.getFacets().stream().filter(
|
||||
queryable -> pivotKey.equals(queryable.getLabel()!=null?queryable.getLabel():queryable.getField())).findFirst();
|
||||
Optional<FacetField> found = facetFields.getFacets().stream()
|
||||
.filter(queryable -> pivotKey.equals(queryable.getLabel() != null ? queryable.getLabel() : queryable.getField())).findFirst();
|
||||
|
||||
if (found.isPresent())
|
||||
{
|
||||
sp.addPivot(found.get().getField());
|
||||
facetFields.getFacets().remove(found.get());
|
||||
searchRequestContext.getPivotKeys().put(found.get().getField(), pivotKey);
|
||||
continue;
|
||||
}
|
||||
else
|
||||
}
|
||||
|
||||
if (piterator.hasNext())
|
||||
{
|
||||
//Its not the last one so lets complain
|
||||
throw new InvalidArgumentException(InvalidArgumentException.DEFAULT_MESSAGE_ID,
|
||||
new Object[] { ": Pivot parameter " + pivotKey + " is does not reference a facet Field." });
|
||||
}
|
||||
else
|
||||
{
|
||||
if (stats != null && !stats.isEmpty())
|
||||
{
|
||||
if (piterator.hasNext())
|
||||
//It is the last one so it can reference stats
|
||||
Optional<StatsRequestParameters> foundStat = stats.stream().filter(stas -> pivotKey.equals(stas.getLabel()!=null?stas.getLabel():stas.getField())).findFirst();
|
||||
if (foundStat.isPresent())
|
||||
{
|
||||
//Its not the last one so lets complain
|
||||
throw new InvalidArgumentException(InvalidArgumentException.DEFAULT_MESSAGE_ID,
|
||||
new Object[] { ": Pivot parameter " + pivotKey + " is does not reference a facet Field." });
|
||||
}
|
||||
else
|
||||
{
|
||||
//It is the last one so it can reference facetquery or stats
|
||||
/**
|
||||
Optional<StatsRequestParameters> foundStat = stats.stream().filter(stas -> pivotKey.equals(stas.getLabel())).findFirst();
|
||||
if (foundStat.isPresent())
|
||||
{
|
||||
stats.remove(foundStat.get());
|
||||
}
|
||||
**/
|
||||
sp.addPivot(pivotKey);
|
||||
searchRequestContext.getPivotKeys().put(pivotKey, pivotKey);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
throw new InvalidArgumentException(InvalidArgumentException.DEFAULT_MESSAGE_ID,
|
||||
new Object[] { ": Pivot parameter " + pivotKey + " is does not reference a facet Field or stats." });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user