/** Parses the list of query items for the query facet. * @param queryFacetObject JSON object representing the node with the query facet. * @return list of query options * @throws JSONException if the list cannot be parsed. */ private List<I_CmsFacetQueryItem> parseFacetQueryItems(final JSONObject queryFacetObject) throws JSONException { final JSONArray items = queryFacetObject.getJSONArray(JSON_KEY_QUERY_FACET_QUERY); List<I_CmsFacetQueryItem> result = new ArrayList<I_CmsFacetQueryItem>(items.length()); for (int i = 0; i < items.length(); i++) { I_CmsFacetQueryItem item = parseFacetQueryItem(items.getJSONObject(i)); if (item != null) { result.add(item); } } return result; }
/** Returns the list of the configured sort options, or the empty list if no sort options are configured. * @return The list of the configured sort options, or the empty list if no sort options are configured. */ private List<I_CmsSearchConfigurationSortOption> getSortOptions() { final List<I_CmsSearchConfigurationSortOption> options = new LinkedList<I_CmsSearchConfigurationSortOption>(); try { final JSONArray sortOptions = m_configObject.getJSONArray(JSON_KEY_SORTOPTIONS); for (int i = 0; i < sortOptions.length(); i++) { final I_CmsSearchConfigurationSortOption option = parseSortOption(sortOptions.getJSONObject(i)); if (option != null) { options.add(option); } } } catch (final JSONException e) { LOG.info(Messages.get().getBundle().key(Messages.LOG_NO_SORT_CONFIG_0), e); } return options; }
for (int i = 0; i < array.length(); i++) { try { favList.add(elementFromJson(array.getJSONObject(i))); } catch (Throwable e) {
/** * @see org.opencms.jsp.search.config.parser.I_CmsSearchConfigurationParser#parseFieldFacets() */ @Override public Map<String, I_CmsSearchConfigurationFacetField> parseFieldFacets() { final Map<String, I_CmsSearchConfigurationFacetField> facetConfigs = new LinkedHashMap<String, I_CmsSearchConfigurationFacetField>(); try { final JSONArray fieldFacets = m_configObject.getJSONArray(JSON_KEY_FIELD_FACETS); for (int i = 0; i < fieldFacets.length(); i++) { final I_CmsSearchConfigurationFacetField config = parseFieldFacet(fieldFacets.getJSONObject(i)); if (config != null) { facetConfigs.put(config.getName(), config); } } } catch (final JSONException e) { LOG.info(Messages.get().getBundle().key(Messages.LOG_NO_FACET_CONFIG_0), e); } return facetConfigs; }
/** * @see org.opencms.jsp.search.config.parser.I_CmsSearchConfigurationParser#parseRangeFacets() */ public Map<String, I_CmsSearchConfigurationFacetRange> parseRangeFacets() { final Map<String, I_CmsSearchConfigurationFacetRange> facetConfigs = new LinkedHashMap<String, I_CmsSearchConfigurationFacetRange>(); try { final JSONArray rangeFacets = m_configObject.getJSONArray(JSON_KEY_RANGE_FACETS); for (int i = 0; i < rangeFacets.length(); i++) { final I_CmsSearchConfigurationFacetRange config = parseRangeFacet(rangeFacets.getJSONObject(i)); if (config != null) { facetConfigs.put(config.getName(), config); } } } catch (final JSONException e) { LOG.info(Messages.get().getBundle().key(Messages.LOG_NO_FACET_CONFIG_0), e); } return facetConfigs; }
for (int i = 0; i < array.length(); i++) { try { recentList.add(elementFromJson(array.getJSONObject(i))); } catch (Throwable e) {
/** Returns a map with additional request parameters, mapping the parameter names to Solr query parts. * @return A map with additional request parameters, mapping the parameter names to Solr query parts. */ private Map<String, String> getAdditionalParameters() { Map<String, String> result; try { JSONArray additionalParams = m_configObject.getJSONArray(JSON_KEY_ADDITIONAL_PARAMETERS); result = new HashMap<String, String>(additionalParams.length()); for (int i = 0; i < additionalParams.length(); i++) { try { JSONObject currentParam = additionalParams.getJSONObject(i); String param = currentParam.getString(JSON_KEY_ADDITIONAL_PARAMETERS_PARAM); String solrQuery = currentParam.getString(JSON_KEY_ADDITIONAL_PARAMETERS_SOLRQUERY); result.put(param, solrQuery); } catch (JSONException e) { LOG.error(Messages.get().getBundle().key(Messages.ERR_ADDITIONAL_PARAMETER_CONFIG_WRONG_0), e); continue; } } } catch (JSONException e) { LOG.info(Messages.get().getBundle().key(Messages.LOG_ADDITIONAL_PARAMETER_CONFIG_NOT_PARSED_0), e); return new HashMap<String, String>(); } return result; }