public class CmsJSONSearchConfigurationParser extends java.lang.Object implements I_CmsSearchConfigurationParser
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
DEFAULT_LAST_QUERY_PARAM
A JSON key.
|
static java.lang.String |
DEFAULT_QUERY_PARAM
A JSON key.
|
static java.lang.String |
DEFAULT_RELOADED_PARAM
A JSON key.
|
static java.lang.String |
JSON_KEY_ADDITIONAL_PARAMETERS
A JSON key.
|
static java.lang.String |
JSON_KEY_ADDITIONAL_PARAMETERS_PARAM
A JSON key.
|
static java.lang.String |
JSON_KEY_ADDITIONAL_PARAMETERS_SOLRQUERY
A JSON key.
|
static java.lang.String |
JSON_KEY_CORE
A JSON key.
|
static java.lang.String |
JSON_KEY_DIDYOUMEAN
A JSON key.
|
static java.lang.String |
JSON_KEY_DIDYOUMEAN_COLLATE
A JSON key.
|
static java.lang.String |
JSON_KEY_DIDYOUMEAN_COUNT
A JSON key.
|
static java.lang.String |
JSON_KEY_DIDYOUMEAN_QUERYPARAM
A JSON key.
|
static java.lang.String |
JSON_KEY_ESCAPE_QUERY_CHARACTERS
A JSON key.
|
static java.lang.String |
JSON_KEY_EXTRASOLRPARAMS
A JSON key.
|
static java.lang.String |
JSON_KEY_FACET_FIELD
A JSON key.
|
static java.lang.String |
JSON_KEY_FACET_FILTERQUERYMODIFIER
A JSON key.
|
static java.lang.String |
JSON_KEY_FACET_IGNOREALLFACETFILTERS
A JSON key.
|
static java.lang.String |
JSON_KEY_FACET_ISANDFACET
A JSON key.
|
static java.lang.String |
JSON_KEY_FACET_LABEL
A JSON key.
|
static java.lang.String |
JSON_KEY_FACET_LIMIT
A JSON key.
|
static java.lang.String |
JSON_KEY_FACET_MINCOUNT
A JSON key.
|
static java.lang.String |
JSON_KEY_FACET_NAME
A JSON key.
|
static java.lang.String |
JSON_KEY_FACET_ORDER
A JSON key.
|
static java.lang.String |
JSON_KEY_FACET_PREFIX
A JSON key.
|
static java.lang.String |
JSON_KEY_FACET_PRESELECTION
A JSON key.
|
static java.lang.String |
JSON_KEY_FIELD_FACETS
The JSON key for the sub-node with all field facet configurations.
|
static java.lang.String |
JSON_KEY_HIGHLIGHTER
The JSON key for the subnode of all highlighting configuration.
|
static java.lang.String |
JSON_KEY_HIGHLIGHTER_ALTERNATE_FIELD
A JSON key.
|
static java.lang.String |
JSON_KEY_HIGHLIGHTER_FASTVECTORHIGHLIGHTING
A JSON key.
|
static java.lang.String |
JSON_KEY_HIGHLIGHTER_FIELD
A JSON key.
|
static java.lang.String |
JSON_KEY_HIGHLIGHTER_FORMATTER
A JSON key.
|
static java.lang.String |
JSON_KEY_HIGHLIGHTER_FRAGMENTER
A JSON key.
|
static java.lang.String |
JSON_KEY_HIGHLIGHTER_FRAGSIZE
A JSON key.
|
static java.lang.String |
JSON_KEY_HIGHLIGHTER_MAX_LENGTH_ALTERNATE_FIELD
A JSON key.
|
static java.lang.String |
JSON_KEY_HIGHLIGHTER_SIMPLE_POST
A JSON key.
|
static java.lang.String |
JSON_KEY_HIGHLIGHTER_SIMPLE_PRE
A JSON key.
|
static java.lang.String |
JSON_KEY_HIGHLIGHTER_SNIPPETS
A JSON key.
|
static java.lang.String |
JSON_KEY_IGNORE_EXPIRATION_DATE
A JSON key.
|
static java.lang.String |
JSON_KEY_IGNORE_QUERY
A JSON key.
|
static java.lang.String |
JSON_KEY_IGNORE_RELEASE_DATE
A JSON key.
|
static java.lang.String |
JSON_KEY_INDEX
A JSON key.
|
static java.lang.String |
JSON_KEY_LAST_QUERYPARAM
A JSON key.
|
static java.lang.String |
JSON_KEY_PAGENAVLENGTH
A JSON key.
|
static java.lang.String |
JSON_KEY_PAGEPARAM
A JSON key.
|
static java.lang.String |
JSON_KEY_PAGESIZE
A JSON key.
|
static java.lang.String |
JSON_KEY_QUERY_FACET
The JSON key for the sub-node with the query facet configuration.
|
static java.lang.String |
JSON_KEY_QUERY_FACET_QUERY
A JSON key.
|
static java.lang.String |
JSON_KEY_QUERY_FACET_QUERY_LABEL
A JSON key.
|
static java.lang.String |
JSON_KEY_QUERY_FACET_QUERY_QUERY
A JSON key.
|
static java.lang.String |
JSON_KEY_QUERY_MODIFIER
A JSON key.
|
static java.lang.String |
JSON_KEY_QUERYPARAM
A JSON key.
|
static java.lang.String |
JSON_KEY_RANGE_FACET_END
A JSON key.
|
static java.lang.String |
JSON_KEY_RANGE_FACET_GAP
A JSON key.
|
static java.lang.String |
JSON_KEY_RANGE_FACET_HARDEND
A JSON key.
|
static java.lang.String |
JSON_KEY_RANGE_FACET_OTHER
A JSON key.
|
static java.lang.String |
JSON_KEY_RANGE_FACET_RANGE
A JSON key.
|
static java.lang.String |
JSON_KEY_RANGE_FACET_START
A JSON key.
|
static java.lang.String |
JSON_KEY_RANGE_FACETS
The JSON key for the sub-node with all field facet configurations.
|
static java.lang.String |
JSON_KEY_RELOADED_PARAM
A JSON key.
|
static java.lang.String |
JSON_KEY_SEARCH_FOR_EMPTY_QUERY
A JSON key.
|
static java.lang.String |
JSON_KEY_SORTOPTION_LABEL
A JSON key.
|
static java.lang.String |
JSON_KEY_SORTOPTION_PARAMVALUE
A JSON key.
|
static java.lang.String |
JSON_KEY_SORTOPTION_SOLRVALUE
A JSON key.
|
static java.lang.String |
JSON_KEY_SORTOPTIONS
The JSON key for the sub-node with all search option configurations.
|
static java.lang.String |
JSON_KEY_SORTPARAM
A JSON key.
|
protected static org.apache.commons.logging.Log |
LOG
Logger for the class.
|
protected JSONObject |
m_configObject
The whole JSON file.
|
| Constructor and Description |
|---|
CmsJSONSearchConfigurationParser(java.lang.String json)
Constructor taking the JSON as String.
|
CmsJSONSearchConfigurationParser(java.lang.String json,
I_CmsSearchConfiguration baseConfig)
Constructor taking the JSON as String.
|
| Modifier and Type | Method and Description |
|---|---|
protected java.util.Map<java.lang.String,java.lang.String> |
getAdditionalParameters()
Returns a map with additional request parameters, mapping the parameter names to Solr query parts.
|
protected java.lang.String |
getCore()
Returns the configured Solr core, or
null if no core is configured. |
protected java.lang.Boolean |
getEscapeQueryChars()
Returns the flag, indicating if the characters in the query string that are commands to Solr should be escaped.
|
protected java.lang.String |
getExtraSolrParams()
Returns the configured extra parameters that should be given to Solr, or the empty string if no parameters are configured.
|
protected java.lang.String |
getFirstCallParam()
Returns the configured request parameter for the last query, or the default parameter if no core is configured.
|
protected java.lang.Boolean |
getIgnoreExpirationDate()
Returns a flag indicating if also expired resources should be found.
|
protected java.lang.Boolean |
getIgnoreQuery()
Returns a flag indicating if the query given by the parameters should be ignored.
|
protected java.lang.Boolean |
getIgnoreReleaseDate()
Returns a flag indicating if also unreleased resources should be found.
|
protected java.lang.String |
getIndex()
Returns the configured Solr index, or
null if no core is configured. |
protected java.lang.String |
getLastQueryParam()
Returns the configured request parameter for the last query, or the default parameter if no core is configured.
|
protected java.lang.Integer |
getPageNavLength()
Returns the configured length of the "Google"-like page navigation, or the default parameter if no core is configured.
|
protected java.lang.String |
getPageParam()
Returns the configured request parameter for the current page, or the default parameter if no core is configured.
|
protected java.util.List<java.lang.Integer> |
getPageSizes()
Returns the configured page sizes, or the default page size if no core is configured.
|
protected java.lang.String |
getQueryModifier()
Returns the optional query modifier.
|
protected java.lang.String |
getQueryParam()
Returns the configured request parameter for the query string, or the default parameter if no core is configured.
|
protected java.lang.Boolean |
getSearchForEmptyQuery()
Returns a flag, indicating if search should be performed using a wildcard if the empty query is given.
|
protected java.util.List<I_CmsSearchConfigurationSortOption> |
getSortOptions()
Returns the list of the configured sort options, or the empty list if no sort options are configured.
|
protected java.lang.String |
getSortParam()
Returns the configured request parameter for the sort option, or the default parameter if no core is configured.
|
protected void |
init(java.lang.String configString,
I_CmsSearchConfiguration baseConfig)
Initialization that parses the String to a JSON object.
|
I_CmsSearchConfigurationCommon |
parseCommon()
Returns the common search configuration.
|
I_CmsSearchConfigurationDidYouMean |
parseDidYouMean()
Returns the configuration for the "Did you mean ...?"
|
protected I_CmsSearchConfigurationFacetQuery.I_CmsFacetQueryItem |
parseFacetQueryItem(JSONObject item)
Parses a single query item for the query facet.
|
protected java.util.List<I_CmsSearchConfigurationFacetQuery.I_CmsFacetQueryItem> |
parseFacetQueryItems(JSONObject queryFacetObject)
Parses the list of query items for the query facet.
|
protected I_CmsSearchConfigurationFacetField |
parseFieldFacet(JSONObject fieldFacetObject)
Parses the field facet configurations.
|
java.util.Map<java.lang.String,I_CmsSearchConfigurationFacetField> |
parseFieldFacets()
Returns the configuration for the field facets.
|
I_CmsSearchConfigurationHighlighting |
parseHighlighter()
Returns the configuration for the highlighting.
|
protected static java.util.List<java.lang.String> |
parseMandatoryStringValues(JSONObject json,
java.lang.String key)
Helper for reading a mandatory String value list - throwing an Exception if parsing fails.
|
protected static java.lang.Boolean |
parseOptionalBooleanValue(JSONObject json,
java.lang.String key)
Helper for reading an optional Boolean value - returning
null if parsing fails. |
protected static java.lang.Integer |
parseOptionalIntValue(JSONObject json,
java.lang.String key)
Helper for reading an optional Integer value - returning
null if parsing fails. |
protected static java.lang.String |
parseOptionalStringValue(JSONObject json,
java.lang.String key)
Helper for reading an optional String value - returning
null if parsing fails. |
protected static java.util.List<java.lang.String> |
parseOptionalStringValues(JSONObject json,
java.lang.String key)
Helper for reading an optional String value list - returning
null if parsing fails for the whole list, otherwise just skipping unparsable entries. |
I_CmsSearchConfigurationPagination |
parsePagination()
Returns the configuration for the pagination.
|
I_CmsSearchConfigurationFacetQuery |
parseQueryFacet()
Returns the configuration for the query facet.
|
protected I_CmsSearchConfigurationFacetRange |
parseRangeFacet(JSONObject rangeFacetObject)
Parses the query facet configurations.
|
java.util.Map<java.lang.String,I_CmsSearchConfigurationFacetRange> |
parseRangeFacets()
Returns the configuration for the range facets.
|
I_CmsSearchConfigurationSorting |
parseSorting()
Returns the configuration for sorting.
|
protected I_CmsSearchConfigurationSortOption |
parseSortOption(JSONObject json)
Returns a single sort option configuration as configured via the methods parameter, or null if the parameter does not specify a sort option.
|
protected static final org.apache.commons.logging.Log LOG
public static final java.lang.String JSON_KEY_QUERYPARAM
public static final java.lang.String JSON_KEY_LAST_QUERYPARAM
public static final java.lang.String JSON_KEY_ESCAPE_QUERY_CHARACTERS
public static final java.lang.String JSON_KEY_RELOADED_PARAM
public static final java.lang.String JSON_KEY_SEARCH_FOR_EMPTY_QUERY
public static final java.lang.String JSON_KEY_IGNORE_QUERY
public static final java.lang.String JSON_KEY_IGNORE_RELEASE_DATE
public static final java.lang.String JSON_KEY_IGNORE_EXPIRATION_DATE
public static final java.lang.String JSON_KEY_QUERY_MODIFIER
public static final java.lang.String JSON_KEY_PAGEPARAM
public static final java.lang.String JSON_KEY_INDEX
public static final java.lang.String JSON_KEY_CORE
public static final java.lang.String JSON_KEY_EXTRASOLRPARAMS
public static final java.lang.String JSON_KEY_ADDITIONAL_PARAMETERS
public static final java.lang.String JSON_KEY_ADDITIONAL_PARAMETERS_PARAM
public static final java.lang.String JSON_KEY_ADDITIONAL_PARAMETERS_SOLRQUERY
public static final java.lang.String JSON_KEY_PAGESIZE
public static final java.lang.String JSON_KEY_PAGENAVLENGTH
public static final java.lang.String JSON_KEY_FIELD_FACETS
public static final java.lang.String JSON_KEY_RANGE_FACETS
public static final java.lang.String JSON_KEY_QUERY_FACET
public static final java.lang.String JSON_KEY_FACET_LIMIT
public static final java.lang.String JSON_KEY_FACET_MINCOUNT
public static final java.lang.String JSON_KEY_FACET_LABEL
public static final java.lang.String JSON_KEY_FACET_FIELD
public static final java.lang.String JSON_KEY_FACET_NAME
public static final java.lang.String JSON_KEY_FACET_PREFIX
public static final java.lang.String JSON_KEY_FACET_ORDER
public static final java.lang.String JSON_KEY_FACET_FILTERQUERYMODIFIER
public static final java.lang.String JSON_KEY_FACET_ISANDFACET
public static final java.lang.String JSON_KEY_FACET_IGNOREALLFACETFILTERS
public static final java.lang.String JSON_KEY_FACET_PRESELECTION
public static final java.lang.String JSON_KEY_RANGE_FACET_RANGE
public static final java.lang.String JSON_KEY_RANGE_FACET_START
public static final java.lang.String JSON_KEY_RANGE_FACET_END
public static final java.lang.String JSON_KEY_RANGE_FACET_GAP
public static final java.lang.String JSON_KEY_RANGE_FACET_OTHER
public static final java.lang.String JSON_KEY_RANGE_FACET_HARDEND
public static final java.lang.String JSON_KEY_QUERY_FACET_QUERY
public static final java.lang.String JSON_KEY_QUERY_FACET_QUERY_QUERY
public static final java.lang.String JSON_KEY_QUERY_FACET_QUERY_LABEL
public static final java.lang.String JSON_KEY_SORTPARAM
public static final java.lang.String JSON_KEY_SORTOPTIONS
public static final java.lang.String JSON_KEY_SORTOPTION_LABEL
public static final java.lang.String JSON_KEY_SORTOPTION_PARAMVALUE
public static final java.lang.String JSON_KEY_SORTOPTION_SOLRVALUE
public static final java.lang.String JSON_KEY_HIGHLIGHTER
public static final java.lang.String JSON_KEY_HIGHLIGHTER_FIELD
public static final java.lang.String JSON_KEY_HIGHLIGHTER_SNIPPETS
public static final java.lang.String JSON_KEY_HIGHLIGHTER_FRAGSIZE
public static final java.lang.String JSON_KEY_HIGHLIGHTER_ALTERNATE_FIELD
public static final java.lang.String JSON_KEY_HIGHLIGHTER_MAX_LENGTH_ALTERNATE_FIELD
public static final java.lang.String JSON_KEY_HIGHLIGHTER_SIMPLE_PRE
public static final java.lang.String JSON_KEY_HIGHLIGHTER_SIMPLE_POST
public static final java.lang.String JSON_KEY_HIGHLIGHTER_FORMATTER
public static final java.lang.String JSON_KEY_HIGHLIGHTER_FRAGMENTER
public static final java.lang.String JSON_KEY_HIGHLIGHTER_FASTVECTORHIGHLIGHTING
public static final java.lang.String JSON_KEY_DIDYOUMEAN
public static final java.lang.String JSON_KEY_DIDYOUMEAN_QUERYPARAM
public static final java.lang.String JSON_KEY_DIDYOUMEAN_COLLATE
public static final java.lang.String JSON_KEY_DIDYOUMEAN_COUNT
public static final java.lang.String DEFAULT_QUERY_PARAM
public static final java.lang.String DEFAULT_LAST_QUERY_PARAM
public static final java.lang.String DEFAULT_RELOADED_PARAM
protected JSONObject m_configObject
public CmsJSONSearchConfigurationParser(java.lang.String json) throws JSONException
json - The JSON that should be parsed as String.JSONException - Thrown if parsing fails.public CmsJSONSearchConfigurationParser(java.lang.String json, I_CmsSearchConfiguration baseConfig) throws JSONException
json - The JSON that should be parsed as String.baseConfig - A base configuration that is adjusted by the JSON configuration string.JSONException - Thrown if parsing fails.protected static java.util.List<java.lang.String> parseMandatoryStringValues(JSONObject json, java.lang.String key) throws JSONException
json - The JSON object where the list should be read from.key - The key of the value to read.JSONException - thrown when parsing fails.protected static java.lang.Boolean parseOptionalBooleanValue(JSONObject json, java.lang.String key)
null if parsing fails.json - The JSON object where the value should be read from.key - The key of the value to read.null if the value does not exist, or is no Boolean.protected static java.lang.Integer parseOptionalIntValue(JSONObject json, java.lang.String key)
null if parsing fails.json - The JSON object where the value should be read from.key - The key of the value to read.null if the value does not exist, or is no Integer.protected static java.lang.String parseOptionalStringValue(JSONObject json, java.lang.String key)
null if parsing fails.json - The JSON object where the value should be read from.key - The key of the value to read.null if the value does not exist.protected static java.util.List<java.lang.String> parseOptionalStringValues(JSONObject json, java.lang.String key)
null if parsing fails for the whole list, otherwise just skipping unparsable entries.json - The JSON object where the list should be read from.key - The key of the value to read.null if the value does not exist.public I_CmsSearchConfigurationCommon parseCommon()
I_CmsSearchConfigurationParserparseCommon in interface I_CmsSearchConfigurationParserI_CmsSearchConfigurationParser.parseCommon()public I_CmsSearchConfigurationDidYouMean parseDidYouMean()
I_CmsSearchConfigurationParserparseDidYouMean in interface I_CmsSearchConfigurationParserI_CmsSearchConfigurationParser.parseDidYouMean()public java.util.Map<java.lang.String,I_CmsSearchConfigurationFacetField> parseFieldFacets()
I_CmsSearchConfigurationParserparseFieldFacets in interface I_CmsSearchConfigurationParserI_CmsSearchConfigurationParser.parseFieldFacets()public I_CmsSearchConfigurationHighlighting parseHighlighter()
I_CmsSearchConfigurationParserparseHighlighter in interface I_CmsSearchConfigurationParserI_CmsSearchConfigurationParser.parseHighlighter()public I_CmsSearchConfigurationPagination parsePagination()
I_CmsSearchConfigurationParserparsePagination in interface I_CmsSearchConfigurationParserI_CmsSearchConfigurationParser.parsePagination()public I_CmsSearchConfigurationFacetQuery parseQueryFacet()
I_CmsSearchConfigurationParserparseQueryFacet in interface I_CmsSearchConfigurationParserI_CmsSearchConfigurationParser.parseQueryFacet()public java.util.Map<java.lang.String,I_CmsSearchConfigurationFacetRange> parseRangeFacets()
I_CmsSearchConfigurationParserparseRangeFacets in interface I_CmsSearchConfigurationParserI_CmsSearchConfigurationParser.parseRangeFacets()public I_CmsSearchConfigurationSorting parseSorting()
I_CmsSearchConfigurationParserparseSorting in interface I_CmsSearchConfigurationParserI_CmsSearchConfigurationParser.parseSorting()protected java.util.Map<java.lang.String,java.lang.String> getAdditionalParameters()
protected java.lang.String getCore()
null if no core is configured.null if no core is configured.protected java.lang.Boolean getEscapeQueryChars()
protected java.lang.String getExtraSolrParams()
protected java.lang.String getFirstCallParam()
protected java.lang.Boolean getIgnoreExpirationDate()
protected java.lang.Boolean getIgnoreQuery()
protected java.lang.Boolean getIgnoreReleaseDate()
protected java.lang.String getIndex()
null if no core is configured.null if no core is configured.protected java.lang.String getLastQueryParam()
protected java.lang.Integer getPageNavLength()
protected java.lang.String getPageParam()
protected java.util.List<java.lang.Integer> getPageSizes()
protected java.lang.String getQueryModifier()
protected java.lang.String getQueryParam()
protected java.lang.Boolean getSearchForEmptyQuery()
protected java.util.List<I_CmsSearchConfigurationSortOption> getSortOptions()
protected java.lang.String getSortParam()
protected void init(java.lang.String configString, I_CmsSearchConfiguration baseConfig) throws JSONException
configString - The JSON as string.baseConfig - The optional basic search configuration to overwrite (partly) by the JSON configuration.JSONException - thrown if parsing fails.protected I_CmsSearchConfigurationFacetQuery.I_CmsFacetQueryItem parseFacetQueryItem(JSONObject item)
item - JSON object of the query item.null if parsing failed.protected java.util.List<I_CmsSearchConfigurationFacetQuery.I_CmsFacetQueryItem> parseFacetQueryItems(JSONObject queryFacetObject) throws JSONException
queryFacetObject - JSON object representing the node with the query facet.JSONException - if the list cannot be parsed.protected I_CmsSearchConfigurationFacetField parseFieldFacet(JSONObject fieldFacetObject)
fieldFacetObject - The JSON sub-node with the field facet configurations.protected I_CmsSearchConfigurationFacetRange parseRangeFacet(JSONObject rangeFacetObject)
rangeFacetObject - The JSON sub-node with the query facet configurations.protected I_CmsSearchConfigurationSortOption parseSortOption(JSONObject json)
json - The JSON sort option configuration.