{
selectedVals.addAll(Arrays.asList(vals));
}
}
FacetAccessible facetAccessible = entry.getValue();
List<BrowseFacet> facetList = facetAccessible.getFacets();
ArrayList<JSONObject> facets = new ArrayList<JSONObject>();
for (BrowseFacet f : facetList)
{
String fval = f.getValue();
if (fval != null && fval.length() > 0)
{
JSONObject fv = new FastJSONObject();
fv.put(PARAM_RESULT_FACET_INFO_COUNT, f.getFacetValueHitCount());
fv.put(PARAM_RESULT_FACET_INFO_VALUE, fval);
fv.put(PARAM_RESULT_FACET_INFO_SELECTED, selectedVals.remove(fval));
facets.add(fv);
}
}
if (selectedVals.size() > 0)
{
// selected vals did not make it in top n
for (String selectedVal : selectedVals)
{
if (selectedVal != null && selectedVal.length() > 0)
{
BrowseFacet selectedFacetVal = facetAccessible.getFacet(selectedVal);
JSONObject fv = new FastJSONObject(5);
fv.put(PARAM_RESULT_FACET_INFO_COUNT, selectedFacetVal == null ? 0 : selectedFacetVal.getFacetValueHitCount());
String fval = selectedFacetVal == null ? selectedVal : selectedFacetVal.getValue();
fv.put(PARAM_RESULT_FACET_INFO_VALUE, fval);
fv.put(PARAM_RESULT_FACET_INFO_SELECTED, true);