use of com.liferay.portal.kernel.search.facet.config.FacetConfiguration in project liferay-ide by liferay.
the class AssetEntriesFacet method initFacetClause.
protected void initFacetClause() {
SearchContext searchContext = getSearchContext();
FacetConfiguration facetConfiguration = getFacetConfiguration();
JSONObject dataJSONObject = facetConfiguration.getData();
String[] entryClassNames = null;
if (dataJSONObject.has("values")) {
JSONArray valuesJSONArray = dataJSONObject.getJSONArray("values");
entryClassNames = new String[valuesJSONArray.length()];
for (int i = 0; i < valuesJSONArray.length(); i++) {
entryClassNames[i] = valuesJSONArray.getString(i);
}
}
if (ArrayUtil.isEmpty(entryClassNames)) {
entryClassNames = searchContext.getEntryClassNames();
}
if (!isStatic()) {
String[] entryClassNameParam = StringUtil.split(GetterUtil.getString(searchContext.getAttribute(getFieldName())));
if (ArrayUtil.isNotEmpty(entryClassNameParam)) {
entryClassNames = entryClassNameParam;
}
}
if (ArrayUtil.isEmpty(entryClassNames)) {
entryClassNames = SearchEngineUtil.getEntryClassNames();
if (!dataJSONObject.has("values")) {
JSONArray entriesJSONArray = JSONFactoryUtil.createJSONArray();
for (String entryClassName : entryClassNames) {
entriesJSONArray.put(entryClassName);
}
dataJSONObject.put("values", entriesJSONArray);
}
}
searchContext.setEntryClassNames(entryClassNames);
}
Aggregations