Class CmsJSONSearchConfigurationParser
- java.lang.Object
-
- org.opencms.jsp.search.config.parser.CmsJSONSearchConfigurationParser
-
- All Implemented Interfaces:
I_CmsSearchConfigurationParser
- Direct Known Subclasses:
CmsSimpleSearchConfigurationParser
public class CmsJSONSearchConfigurationParser extends java.lang.Object implements I_CmsSearchConfigurationParser
Search configuration parser reading JSON.
-
-
Field Summary
Fields Modifier and Type Field 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_DEFAULT_SORT_OPTION
The JSON key for the default sort option, should hold the name paramvalue for the default option.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_EXCLUDETAGS
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_GEO_FILTER
JSON keys for the Geo filter.static java.lang.String
JSON_KEY_GEO_FILTER_COORDINATES
A JSON key.static java.lang.String
JSON_KEY_GEO_FILTER_COORDINATES_PARAM
A JSON key.static java.lang.String
JSON_KEY_GEO_FILTER_FIELD_NAME
A JSON key.static java.lang.String
JSON_KEY_GEO_FILTER_RADIUS
A JSON key.static java.lang.String
JSON_KEY_GEO_FILTER_RADIUS_PARAM
A JSON key.static java.lang.String
JSON_KEY_GEO_FILTER_UNITS
A JSON key.static java.lang.String
JSON_KEY_GEO_FILTER_UNITS_PARAM
A JSON key.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_MAX_RETURNED_RESULTS
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 Summary
Constructors Constructor 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.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method 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, ornull
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(CmsObject cms)
Returns the configured Solr index, ornull
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 int
getMaxReturnedResults(java.lang.String indexName)
Returns the number of maximally returned results, ornull
if the indexes default should be used.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(CmsObject cms)
Returns the common search configuration.I_CmsSearchConfigurationDidYouMean
parseDidYouMean()
Returns the configuration for the "Did you mean ...?" feature.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_CmsSearchConfigurationGeoFilter
parseGeoFilter()
Returns the configuration for the Geo filter.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 - returningnull
if parsing fails.protected static java.lang.Integer
parseOptionalIntValue(JSONObject json, java.lang.String key)
Helper for reading an optional Integer value - returningnull
if parsing fails.protected static java.lang.String
parseOptionalStringValue(JSONObject json, java.lang.String key)
Helper for reading an optional String value - returningnull
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 - returningnull
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.
-
-
-
Field Detail
-
LOG
protected static final org.apache.commons.logging.Log LOG
Logger for the class.
-
JSON_KEY_QUERYPARAM
public static final java.lang.String JSON_KEY_QUERYPARAM
A JSON key.- See Also:
- Constant Field Values
-
JSON_KEY_LAST_QUERYPARAM
public static final java.lang.String JSON_KEY_LAST_QUERYPARAM
A JSON key.- See Also:
- Constant Field Values
-
JSON_KEY_ESCAPE_QUERY_CHARACTERS
public static final java.lang.String JSON_KEY_ESCAPE_QUERY_CHARACTERS
A JSON key.- See Also:
- Constant Field Values
-
JSON_KEY_RELOADED_PARAM
public static final java.lang.String JSON_KEY_RELOADED_PARAM
A JSON key.- See Also:
- Constant Field Values
-
JSON_KEY_SEARCH_FOR_EMPTY_QUERY
public static final java.lang.String JSON_KEY_SEARCH_FOR_EMPTY_QUERY
A JSON key.- See Also:
- Constant Field Values
-
JSON_KEY_IGNORE_QUERY
public static final java.lang.String JSON_KEY_IGNORE_QUERY
A JSON key.- See Also:
- Constant Field Values
-
JSON_KEY_IGNORE_RELEASE_DATE
public static final java.lang.String JSON_KEY_IGNORE_RELEASE_DATE
A JSON key.- See Also:
- Constant Field Values
-
JSON_KEY_MAX_RETURNED_RESULTS
public static final java.lang.String JSON_KEY_MAX_RETURNED_RESULTS
A JSON key.- See Also:
- Constant Field Values
-
JSON_KEY_IGNORE_EXPIRATION_DATE
public static final java.lang.String JSON_KEY_IGNORE_EXPIRATION_DATE
A JSON key.- See Also:
- Constant Field Values
-
JSON_KEY_QUERY_MODIFIER
public static final java.lang.String JSON_KEY_QUERY_MODIFIER
A JSON key.- See Also:
- Constant Field Values
-
JSON_KEY_PAGEPARAM
public static final java.lang.String JSON_KEY_PAGEPARAM
A JSON key.- See Also:
- Constant Field Values
-
JSON_KEY_INDEX
public static final java.lang.String JSON_KEY_INDEX
A JSON key.- See Also:
- Constant Field Values
-
JSON_KEY_CORE
public static final java.lang.String JSON_KEY_CORE
A JSON key.- See Also:
- Constant Field Values
-
JSON_KEY_EXTRASOLRPARAMS
public static final java.lang.String JSON_KEY_EXTRASOLRPARAMS
A JSON key.- See Also:
- Constant Field Values
-
JSON_KEY_ADDITIONAL_PARAMETERS
public static final java.lang.String JSON_KEY_ADDITIONAL_PARAMETERS
A JSON key.- See Also:
- Constant Field Values
-
JSON_KEY_ADDITIONAL_PARAMETERS_PARAM
public static final java.lang.String JSON_KEY_ADDITIONAL_PARAMETERS_PARAM
A JSON key.- See Also:
- Constant Field Values
-
JSON_KEY_ADDITIONAL_PARAMETERS_SOLRQUERY
public static final java.lang.String JSON_KEY_ADDITIONAL_PARAMETERS_SOLRQUERY
A JSON key.- See Also:
- Constant Field Values
-
JSON_KEY_PAGESIZE
public static final java.lang.String JSON_KEY_PAGESIZE
A JSON key.- See Also:
- Constant Field Values
-
JSON_KEY_PAGENAVLENGTH
public static final java.lang.String JSON_KEY_PAGENAVLENGTH
A JSON key.- See Also:
- Constant Field Values
-
JSON_KEY_FIELD_FACETS
public static final java.lang.String JSON_KEY_FIELD_FACETS
The JSON key for the sub-node with all field facet configurations.- See Also:
- Constant Field Values
-
JSON_KEY_RANGE_FACETS
public static final java.lang.String JSON_KEY_RANGE_FACETS
The JSON key for the sub-node with all field facet configurations.- See Also:
- Constant Field Values
-
JSON_KEY_QUERY_FACET
public static final java.lang.String JSON_KEY_QUERY_FACET
The JSON key for the sub-node with the query facet configuration.- See Also:
- Constant Field Values
-
JSON_KEY_FACET_LIMIT
public static final java.lang.String JSON_KEY_FACET_LIMIT
A JSON key.- See Also:
- Constant Field Values
-
JSON_KEY_FACET_MINCOUNT
public static final java.lang.String JSON_KEY_FACET_MINCOUNT
A JSON key.- See Also:
- Constant Field Values
-
JSON_KEY_FACET_LABEL
public static final java.lang.String JSON_KEY_FACET_LABEL
A JSON key.- See Also:
- Constant Field Values
-
JSON_KEY_FACET_FIELD
public static final java.lang.String JSON_KEY_FACET_FIELD
A JSON key.- See Also:
- Constant Field Values
-
JSON_KEY_FACET_NAME
public static final java.lang.String JSON_KEY_FACET_NAME
A JSON key.- See Also:
- Constant Field Values
-
JSON_KEY_FACET_PREFIX
public static final java.lang.String JSON_KEY_FACET_PREFIX
A JSON key.- See Also:
- Constant Field Values
-
JSON_KEY_FACET_ORDER
public static final java.lang.String JSON_KEY_FACET_ORDER
A JSON key.- See Also:
- Constant Field Values
-
JSON_KEY_FACET_FILTERQUERYMODIFIER
public static final java.lang.String JSON_KEY_FACET_FILTERQUERYMODIFIER
A JSON key.- See Also:
- Constant Field Values
-
JSON_KEY_FACET_ISANDFACET
public static final java.lang.String JSON_KEY_FACET_ISANDFACET
A JSON key.- See Also:
- Constant Field Values
-
JSON_KEY_FACET_IGNOREALLFACETFILTERS
public static final java.lang.String JSON_KEY_FACET_IGNOREALLFACETFILTERS
A JSON key.- See Also:
- Constant Field Values
-
JSON_KEY_FACET_EXCLUDETAGS
public static final java.lang.String JSON_KEY_FACET_EXCLUDETAGS
A JSON key.- See Also:
- Constant Field Values
-
JSON_KEY_FACET_PRESELECTION
public static final java.lang.String JSON_KEY_FACET_PRESELECTION
A JSON key.- See Also:
- Constant Field Values
-
JSON_KEY_RANGE_FACET_RANGE
public static final java.lang.String JSON_KEY_RANGE_FACET_RANGE
A JSON key.- See Also:
- Constant Field Values
-
JSON_KEY_RANGE_FACET_START
public static final java.lang.String JSON_KEY_RANGE_FACET_START
A JSON key.- See Also:
- Constant Field Values
-
JSON_KEY_RANGE_FACET_END
public static final java.lang.String JSON_KEY_RANGE_FACET_END
A JSON key.- See Also:
- Constant Field Values
-
JSON_KEY_RANGE_FACET_GAP
public static final java.lang.String JSON_KEY_RANGE_FACET_GAP
A JSON key.- See Also:
- Constant Field Values
-
JSON_KEY_RANGE_FACET_OTHER
public static final java.lang.String JSON_KEY_RANGE_FACET_OTHER
A JSON key.- See Also:
- Constant Field Values
-
JSON_KEY_RANGE_FACET_HARDEND
public static final java.lang.String JSON_KEY_RANGE_FACET_HARDEND
A JSON key.- See Also:
- Constant Field Values
-
JSON_KEY_QUERY_FACET_QUERY
public static final java.lang.String JSON_KEY_QUERY_FACET_QUERY
A JSON key.- See Also:
- Constant Field Values
-
JSON_KEY_QUERY_FACET_QUERY_QUERY
public static final java.lang.String JSON_KEY_QUERY_FACET_QUERY_QUERY
A JSON key.- See Also:
- Constant Field Values
-
JSON_KEY_QUERY_FACET_QUERY_LABEL
public static final java.lang.String JSON_KEY_QUERY_FACET_QUERY_LABEL
A JSON key.- See Also:
- Constant Field Values
-
JSON_KEY_SORTPARAM
public static final java.lang.String JSON_KEY_SORTPARAM
A JSON key.- See Also:
- Constant Field Values
-
JSON_KEY_DEFAULT_SORT_OPTION
public static final java.lang.String JSON_KEY_DEFAULT_SORT_OPTION
The JSON key for the default sort option, should hold the name paramvalue for the default option.- See Also:
- Constant Field Values
-
JSON_KEY_SORTOPTIONS
public static final java.lang.String JSON_KEY_SORTOPTIONS
The JSON key for the sub-node with all search option configurations.- See Also:
- Constant Field Values
-
JSON_KEY_SORTOPTION_LABEL
public static final java.lang.String JSON_KEY_SORTOPTION_LABEL
A JSON key.- See Also:
- Constant Field Values
-
JSON_KEY_SORTOPTION_PARAMVALUE
public static final java.lang.String JSON_KEY_SORTOPTION_PARAMVALUE
A JSON key.- See Also:
- Constant Field Values
-
JSON_KEY_SORTOPTION_SOLRVALUE
public static final java.lang.String JSON_KEY_SORTOPTION_SOLRVALUE
A JSON key.- See Also:
- Constant Field Values
-
JSON_KEY_HIGHLIGHTER
public static final java.lang.String JSON_KEY_HIGHLIGHTER
The JSON key for the subnode of all highlighting configuration.- See Also:
- Constant Field Values
-
JSON_KEY_HIGHLIGHTER_FIELD
public static final java.lang.String JSON_KEY_HIGHLIGHTER_FIELD
A JSON key.- See Also:
- Constant Field Values
-
JSON_KEY_HIGHLIGHTER_SNIPPETS
public static final java.lang.String JSON_KEY_HIGHLIGHTER_SNIPPETS
A JSON key.- See Also:
- Constant Field Values
-
JSON_KEY_HIGHLIGHTER_FRAGSIZE
public static final java.lang.String JSON_KEY_HIGHLIGHTER_FRAGSIZE
A JSON key.- See Also:
- Constant Field Values
-
JSON_KEY_HIGHLIGHTER_ALTERNATE_FIELD
public static final java.lang.String JSON_KEY_HIGHLIGHTER_ALTERNATE_FIELD
A JSON key.- See Also:
- Constant Field Values
-
JSON_KEY_HIGHLIGHTER_MAX_LENGTH_ALTERNATE_FIELD
public static final java.lang.String JSON_KEY_HIGHLIGHTER_MAX_LENGTH_ALTERNATE_FIELD
A JSON key.- See Also:
- Constant Field Values
-
JSON_KEY_HIGHLIGHTER_SIMPLE_PRE
public static final java.lang.String JSON_KEY_HIGHLIGHTER_SIMPLE_PRE
A JSON key.- See Also:
- Constant Field Values
-
JSON_KEY_HIGHLIGHTER_SIMPLE_POST
public static final java.lang.String JSON_KEY_HIGHLIGHTER_SIMPLE_POST
A JSON key.- See Also:
- Constant Field Values
-
JSON_KEY_HIGHLIGHTER_FORMATTER
public static final java.lang.String JSON_KEY_HIGHLIGHTER_FORMATTER
A JSON key.- See Also:
- Constant Field Values
-
JSON_KEY_HIGHLIGHTER_FRAGMENTER
public static final java.lang.String JSON_KEY_HIGHLIGHTER_FRAGMENTER
A JSON key.- See Also:
- Constant Field Values
-
JSON_KEY_HIGHLIGHTER_FASTVECTORHIGHLIGHTING
public static final java.lang.String JSON_KEY_HIGHLIGHTER_FASTVECTORHIGHLIGHTING
A JSON key.- See Also:
- Constant Field Values
-
JSON_KEY_DIDYOUMEAN
public static final java.lang.String JSON_KEY_DIDYOUMEAN
A JSON key.- See Also:
- Constant Field Values
-
JSON_KEY_DIDYOUMEAN_QUERYPARAM
public static final java.lang.String JSON_KEY_DIDYOUMEAN_QUERYPARAM
A JSON key.- See Also:
- Constant Field Values
-
JSON_KEY_DIDYOUMEAN_COLLATE
public static final java.lang.String JSON_KEY_DIDYOUMEAN_COLLATE
A JSON key.- See Also:
- Constant Field Values
-
JSON_KEY_DIDYOUMEAN_COUNT
public static final java.lang.String JSON_KEY_DIDYOUMEAN_COUNT
A JSON key.- See Also:
- Constant Field Values
-
JSON_KEY_GEO_FILTER
public static final java.lang.String JSON_KEY_GEO_FILTER
JSON keys for the Geo filter.- See Also:
- Constant Field Values
-
JSON_KEY_GEO_FILTER_COORDINATES
public static final java.lang.String JSON_KEY_GEO_FILTER_COORDINATES
A JSON key.- See Also:
- Constant Field Values
-
JSON_KEY_GEO_FILTER_COORDINATES_PARAM
public static final java.lang.String JSON_KEY_GEO_FILTER_COORDINATES_PARAM
A JSON key.- See Also:
- Constant Field Values
-
JSON_KEY_GEO_FILTER_FIELD_NAME
public static final java.lang.String JSON_KEY_GEO_FILTER_FIELD_NAME
A JSON key.- See Also:
- Constant Field Values
-
JSON_KEY_GEO_FILTER_RADIUS
public static final java.lang.String JSON_KEY_GEO_FILTER_RADIUS
A JSON key.- See Also:
- Constant Field Values
-
JSON_KEY_GEO_FILTER_RADIUS_PARAM
public static final java.lang.String JSON_KEY_GEO_FILTER_RADIUS_PARAM
A JSON key.- See Also:
- Constant Field Values
-
JSON_KEY_GEO_FILTER_UNITS
public static final java.lang.String JSON_KEY_GEO_FILTER_UNITS
A JSON key.- See Also:
- Constant Field Values
-
JSON_KEY_GEO_FILTER_UNITS_PARAM
public static final java.lang.String JSON_KEY_GEO_FILTER_UNITS_PARAM
A JSON key.- See Also:
- Constant Field Values
-
DEFAULT_QUERY_PARAM
public static final java.lang.String DEFAULT_QUERY_PARAM
A JSON key.- See Also:
- Constant Field Values
-
DEFAULT_LAST_QUERY_PARAM
public static final java.lang.String DEFAULT_LAST_QUERY_PARAM
A JSON key.- See Also:
- Constant Field Values
-
DEFAULT_RELOADED_PARAM
public static final java.lang.String DEFAULT_RELOADED_PARAM
A JSON key.- See Also:
- Constant Field Values
-
m_configObject
protected JSONObject m_configObject
The whole JSON file.
-
-
Constructor Detail
-
CmsJSONSearchConfigurationParser
public CmsJSONSearchConfigurationParser(java.lang.String json) throws JSONException
Constructor taking the JSON as String.- Parameters:
json
- The JSON that should be parsed as String.- Throws:
JSONException
- Thrown if parsing fails.
-
CmsJSONSearchConfigurationParser
public CmsJSONSearchConfigurationParser(java.lang.String json, I_CmsSearchConfiguration baseConfig) throws JSONException
Constructor taking the JSON as String.- Parameters:
json
- The JSON that should be parsed as String.baseConfig
- A base configuration that is adjusted by the JSON configuration string.- Throws:
JSONException
- Thrown if parsing fails.
-
-
Method Detail
-
parseMandatoryStringValues
protected static java.util.List<java.lang.String> parseMandatoryStringValues(JSONObject json, java.lang.String key) throws JSONException
Helper for reading a mandatory String value list - throwing an Exception if parsing fails.- Parameters:
json
- The JSON object where the list should be read from.key
- The key of the value to read.- Returns:
- The value from the JSON.
- Throws:
JSONException
- thrown when parsing fails.
-
parseOptionalBooleanValue
protected static java.lang.Boolean parseOptionalBooleanValue(JSONObject json, java.lang.String key)
Helper for reading an optional Boolean value - returningnull
if parsing fails.- Parameters:
json
- The JSON object where the value should be read from.key
- The key of the value to read.- Returns:
- The value from the JSON, or
null
if the value does not exist, or is no Boolean.
-
parseOptionalIntValue
protected static java.lang.Integer parseOptionalIntValue(JSONObject json, java.lang.String key)
Helper for reading an optional Integer value - returningnull
if parsing fails.- Parameters:
json
- The JSON object where the value should be read from.key
- The key of the value to read.- Returns:
- The value from the JSON, or
null
if the value does not exist, or is no Integer.
-
parseOptionalStringValue
protected static java.lang.String parseOptionalStringValue(JSONObject json, java.lang.String key)
Helper for reading an optional String value - returningnull
if parsing fails.- Parameters:
json
- The JSON object where the value should be read from.key
- The key of the value to read.- Returns:
- The value from the JSON, or
null
if the value does not exist.
-
parseOptionalStringValues
protected static java.util.List<java.lang.String> parseOptionalStringValues(JSONObject json, java.lang.String key)
Helper for reading an optional String value list - returningnull
if parsing fails for the whole list, otherwise just skipping unparsable entries.- Parameters:
json
- The JSON object where the list should be read from.key
- The key of the value to read.- Returns:
- The value from the JSON, or
null
if the value does not exist.
-
parseCommon
public I_CmsSearchConfigurationCommon parseCommon(CmsObject cms)
Description copied from interface:I_CmsSearchConfigurationParser
Returns the common search configuration.- Specified by:
parseCommon
in interfaceI_CmsSearchConfigurationParser
- Parameters:
cms
- the current context- Returns:
- The common search configuration.
- See Also:
I_CmsSearchConfigurationParser.parseCommon(CmsObject)
-
parseDidYouMean
public I_CmsSearchConfigurationDidYouMean parseDidYouMean()
Description copied from interface:I_CmsSearchConfigurationParser
Returns the configuration for the "Did you mean ...?" feature.- Specified by:
parseDidYouMean
in interfaceI_CmsSearchConfigurationParser
- Returns:
- The configuration for the "Did you mean ...?" feature.
- See Also:
I_CmsSearchConfigurationParser.parseDidYouMean()
-
parseFieldFacets
public java.util.Map<java.lang.String,I_CmsSearchConfigurationFacetField> parseFieldFacets()
Description copied from interface:I_CmsSearchConfigurationParser
Returns the configuration for the field facets.- Specified by:
parseFieldFacets
in interfaceI_CmsSearchConfigurationParser
- Returns:
- The configuration for the field facets.
- See Also:
I_CmsSearchConfigurationParser.parseFieldFacets()
-
parseGeoFilter
public I_CmsSearchConfigurationGeoFilter parseGeoFilter()
Description copied from interface:I_CmsSearchConfigurationParser
Returns the configuration for the Geo filter.- Specified by:
parseGeoFilter
in interfaceI_CmsSearchConfigurationParser
- Returns:
- The configuration for the Geo filter.
- See Also:
I_CmsSearchConfigurationParser.parseGeoFilter()
-
parseHighlighter
public I_CmsSearchConfigurationHighlighting parseHighlighter()
Description copied from interface:I_CmsSearchConfigurationParser
Returns the configuration for the highlighting.- Specified by:
parseHighlighter
in interfaceI_CmsSearchConfigurationParser
- Returns:
- The configuration for the highlighting.
- See Also:
I_CmsSearchConfigurationParser.parseHighlighter()
-
parsePagination
public I_CmsSearchConfigurationPagination parsePagination()
Description copied from interface:I_CmsSearchConfigurationParser
Returns the configuration for the pagination.- Specified by:
parsePagination
in interfaceI_CmsSearchConfigurationParser
- Returns:
- The configuration for the pagination.
- See Also:
I_CmsSearchConfigurationParser.parsePagination()
-
parseQueryFacet
public I_CmsSearchConfigurationFacetQuery parseQueryFacet()
Description copied from interface:I_CmsSearchConfigurationParser
Returns the configuration for the query facet.- Specified by:
parseQueryFacet
in interfaceI_CmsSearchConfigurationParser
- Returns:
- The configuration for the query facet.
- See Also:
I_CmsSearchConfigurationParser.parseQueryFacet()
-
parseRangeFacets
public java.util.Map<java.lang.String,I_CmsSearchConfigurationFacetRange> parseRangeFacets()
Description copied from interface:I_CmsSearchConfigurationParser
Returns the configuration for the range facets.- Specified by:
parseRangeFacets
in interfaceI_CmsSearchConfigurationParser
- Returns:
- The configuration for the range facets.
- See Also:
I_CmsSearchConfigurationParser.parseRangeFacets()
-
parseSorting
public I_CmsSearchConfigurationSorting parseSorting()
Description copied from interface:I_CmsSearchConfigurationParser
Returns the configuration for sorting.- Specified by:
parseSorting
in interfaceI_CmsSearchConfigurationParser
- Returns:
- The configuration for sorting.
- See Also:
I_CmsSearchConfigurationParser.parseSorting()
-
getAdditionalParameters
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.- Returns:
- A map with additional request parameters, mapping the parameter names to Solr query parts.
-
getCore
protected java.lang.String getCore()
Returns the configured Solr core, ornull
if no core is configured.- Returns:
- The configured Solr core, or
null
if no core is configured.
-
getEscapeQueryChars
protected java.lang.Boolean getEscapeQueryChars()
Returns the flag, indicating if the characters in the query string that are commands to Solr should be escaped.- Returns:
- the flag, indicating if the characters in the query string that are commands to Solr should be escaped.
-
getExtraSolrParams
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.- Returns:
- The configured extra parameters that should be given to Solr, or the empty string if no parameters are configured.
-
getFirstCallParam
protected java.lang.String getFirstCallParam()
Returns the configured request parameter for the last query, or the default parameter if no core is configured.- Returns:
- The configured request parameter for the last query, or the default parameter if no core is configured.
-
getIgnoreExpirationDate
protected java.lang.Boolean getIgnoreExpirationDate()
Returns a flag indicating if also expired resources should be found.- Returns:
- A flag indicating if also expired resources should be found.
-
getIgnoreQuery
protected java.lang.Boolean getIgnoreQuery()
Returns a flag indicating if the query given by the parameters should be ignored.- Returns:
- A flag indicating if the query given by the parameters should be ignored.
-
getIgnoreReleaseDate
protected java.lang.Boolean getIgnoreReleaseDate()
Returns a flag indicating if also unreleased resources should be found.- Returns:
- A flag indicating if also unreleased resources should be found.
-
getIndex
protected java.lang.String getIndex(CmsObject cms)
Returns the configured Solr index, ornull
if no core is configured.- Parameters:
cms
- the current context.- Returns:
- The configured Solr index, or
null
if no core is configured.
-
getLastQueryParam
protected java.lang.String getLastQueryParam()
Returns the configured request parameter for the last query, or the default parameter if no core is configured.- Returns:
- The configured request parameter for the last query, or the default parameter if no core is configured.
-
getMaxReturnedResults
protected int getMaxReturnedResults(java.lang.String indexName)
Returns the number of maximally returned results, ornull
if the indexes default should be used.- Parameters:
indexName
- the name of the index to search in.- Returns:
- The number of maximally returned results, or
null
if the indexes default should be used.
-
getPageNavLength
protected java.lang.Integer getPageNavLength()
Returns the configured length of the "Google"-like page navigation, or the default parameter if no core is configured.- Returns:
- The configured length of the "Google"-like page navigation, or the default parameter if no core is configured.
-
getPageParam
protected java.lang.String getPageParam()
Returns the configured request parameter for the current page, or the default parameter if no core is configured.- Returns:
- The configured request parameter for the current page, or the default parameter if no core is configured.
-
getPageSizes
protected java.util.List<java.lang.Integer> getPageSizes()
Returns the configured page sizes, or the default page size if no core is configured.- Returns:
- The configured page sizes, or the default page size if no core is configured.
-
getQueryModifier
protected java.lang.String getQueryModifier()
Returns the optional query modifier.- Returns:
- the optional query modifier.
-
getQueryParam
protected java.lang.String getQueryParam()
Returns the configured request parameter for the query string, or the default parameter if no core is configured.- Returns:
- The configured request parameter for the query string, or the default parameter if no core is configured.
-
getSearchForEmptyQuery
protected java.lang.Boolean getSearchForEmptyQuery()
Returns a flag, indicating if search should be performed using a wildcard if the empty query is given.- Returns:
- A flag, indicating if search should be performed using a wildcard if the empty query is given.
-
getSortOptions
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.- Returns:
- The list of the configured sort options, or the empty list if no sort options are configured.
-
getSortParam
protected java.lang.String getSortParam()
Returns the configured request parameter for the sort option, or the default parameter if no core is configured.- Returns:
- The configured request parameter for the sort option, or the default parameter if no core is configured.
-
init
protected void init(java.lang.String configString, I_CmsSearchConfiguration baseConfig) throws JSONException
Initialization that parses the String to a JSON object.- Parameters:
configString
- The JSON as string.baseConfig
- The optional basic search configuration to overwrite (partly) by the JSON configuration.- Throws:
JSONException
- thrown if parsing fails.
-
parseFacetQueryItem
protected I_CmsSearchConfigurationFacetQuery.I_CmsFacetQueryItem parseFacetQueryItem(JSONObject item)
Parses a single query item for the query facet.- Parameters:
item
- JSON object of the query item.- Returns:
- the parsed query item, or
null
if parsing failed.
-
parseFacetQueryItems
protected java.util.List<I_CmsSearchConfigurationFacetQuery.I_CmsFacetQueryItem> parseFacetQueryItems(JSONObject queryFacetObject) throws JSONException
Parses the list of query items for the query facet.- Parameters:
queryFacetObject
- JSON object representing the node with the query facet.- Returns:
- list of query options
- Throws:
JSONException
- if the list cannot be parsed.
-
parseFieldFacet
protected I_CmsSearchConfigurationFacetField parseFieldFacet(JSONObject fieldFacetObject)
Parses the field facet configurations.- Parameters:
fieldFacetObject
- The JSON sub-node with the field facet configurations.- Returns:
- The field facet configurations.
-
parseRangeFacet
protected I_CmsSearchConfigurationFacetRange parseRangeFacet(JSONObject rangeFacetObject)
Parses the query facet configurations.- Parameters:
rangeFacetObject
- The JSON sub-node with the query facet configurations.- Returns:
- The query facet configurations.
-
parseSortOption
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.- Parameters:
json
- The JSON sort option configuration.- Returns:
- The sort option configuration, or null if the JSON could not be read.
-
-