Class CmsSimpleSearchConfigurationParser
- java.lang.Object
-
- org.opencms.jsp.search.config.parser.CmsJSONSearchConfigurationParser
-
- org.opencms.jsp.search.config.parser.CmsSimpleSearchConfigurationParser
-
- All Implemented Interfaces:
I_CmsSearchConfigurationParser
public class CmsSimpleSearchConfigurationParser extends CmsJSONSearchConfigurationParser
Search configuration parser using a list configuration file as the base configuration with additional JSON.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CmsSimpleSearchConfigurationParser.SortOption
Sort options that are available by default.
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
FIELD_CATEGORIES
SOLR field name.static java.lang.String
FIELD_DATE
SOLR field name.static java.lang.String
FIELD_DATE_FACET_NAME
SOLR field name.static java.lang.String
FIELD_DATE_RANGE
SOLR field name.static java.lang.String
FIELD_PARENT_FOLDERS
SOLR field name.-
Fields inherited from class org.opencms.jsp.search.config.parser.CmsJSONSearchConfigurationParser
DEFAULT_LAST_QUERY_PARAM, DEFAULT_QUERY_PARAM, DEFAULT_RELOADED_PARAM, JSON_KEY_ADDITIONAL_PARAMETERS, JSON_KEY_ADDITIONAL_PARAMETERS_PARAM, JSON_KEY_ADDITIONAL_PARAMETERS_SOLRQUERY, JSON_KEY_CORE, JSON_KEY_DEFAULT_SORT_OPTION, JSON_KEY_DIDYOUMEAN, JSON_KEY_DIDYOUMEAN_COLLATE, JSON_KEY_DIDYOUMEAN_COUNT, JSON_KEY_DIDYOUMEAN_QUERYPARAM, JSON_KEY_ESCAPE_QUERY_CHARACTERS, JSON_KEY_EXTRASOLRPARAMS, JSON_KEY_FACET_EXCLUDETAGS, JSON_KEY_FACET_FIELD, JSON_KEY_FACET_FILTERQUERYMODIFIER, JSON_KEY_FACET_IGNOREALLFACETFILTERS, JSON_KEY_FACET_ISANDFACET, JSON_KEY_FACET_LABEL, JSON_KEY_FACET_LIMIT, JSON_KEY_FACET_MINCOUNT, JSON_KEY_FACET_NAME, JSON_KEY_FACET_ORDER, JSON_KEY_FACET_PREFIX, JSON_KEY_FACET_PRESELECTION, JSON_KEY_FIELD_FACETS, JSON_KEY_GEO_FILTER, JSON_KEY_GEO_FILTER_COORDINATES, JSON_KEY_GEO_FILTER_COORDINATES_PARAM, JSON_KEY_GEO_FILTER_FIELD_NAME, JSON_KEY_GEO_FILTER_RADIUS, JSON_KEY_GEO_FILTER_RADIUS_PARAM, JSON_KEY_GEO_FILTER_UNITS, JSON_KEY_GEO_FILTER_UNITS_PARAM, JSON_KEY_HIGHLIGHTER, JSON_KEY_HIGHLIGHTER_ALTERNATE_FIELD, JSON_KEY_HIGHLIGHTER_FASTVECTORHIGHLIGHTING, JSON_KEY_HIGHLIGHTER_FIELD, JSON_KEY_HIGHLIGHTER_FORMATTER, JSON_KEY_HIGHLIGHTER_FRAGMENTER, JSON_KEY_HIGHLIGHTER_FRAGSIZE, JSON_KEY_HIGHLIGHTER_MAX_LENGTH_ALTERNATE_FIELD, JSON_KEY_HIGHLIGHTER_SIMPLE_POST, JSON_KEY_HIGHLIGHTER_SIMPLE_PRE, JSON_KEY_HIGHLIGHTER_SNIPPETS, JSON_KEY_IGNORE_EXPIRATION_DATE, JSON_KEY_IGNORE_QUERY, JSON_KEY_IGNORE_RELEASE_DATE, JSON_KEY_INDEX, JSON_KEY_LAST_QUERYPARAM, JSON_KEY_MAX_RETURNED_RESULTS, JSON_KEY_PAGENAVLENGTH, JSON_KEY_PAGEPARAM, JSON_KEY_PAGESIZE, JSON_KEY_QUERY_FACET, JSON_KEY_QUERY_FACET_QUERY, JSON_KEY_QUERY_FACET_QUERY_LABEL, JSON_KEY_QUERY_FACET_QUERY_QUERY, JSON_KEY_QUERY_MODIFIER, JSON_KEY_QUERYPARAM, JSON_KEY_RANGE_FACET_END, JSON_KEY_RANGE_FACET_GAP, JSON_KEY_RANGE_FACET_HARDEND, JSON_KEY_RANGE_FACET_OTHER, JSON_KEY_RANGE_FACET_RANGE, JSON_KEY_RANGE_FACET_START, JSON_KEY_RANGE_FACETS, JSON_KEY_RELOADED_PARAM, JSON_KEY_SEARCH_FOR_EMPTY_QUERY, JSON_KEY_SORTOPTION_LABEL, JSON_KEY_SORTOPTION_PARAMVALUE, JSON_KEY_SORTOPTION_SOLRVALUE, JSON_KEY_SORTOPTIONS, JSON_KEY_SORTPARAM, LOG, m_configObject
-
-
Constructor Summary
Constructors Constructor Description CmsSimpleSearchConfigurationParser(CmsObject cms, CmsConfigurationBean config, java.lang.String additionalParamJSON)
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static CmsSimpleSearchConfigurationParser
createInstanceWithNoJsonConfig(CmsObject cms, CmsConfigurationBean config)
Creates an instance for an empty JSON configuration.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.Boolean
getIgnoreExpirationDate()
Returns a flag indicating if also expired resources should be found.protected java.lang.Boolean
getIgnoreReleaseDate()
Returns a flag indicating if also unreleased resources should be found.CmsSolrQuery
getInitialQuery()
Returns the initial SOLR query.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.String
getQueryModifier()
Returns the optional query modifier.protected java.lang.Boolean
getSearchForEmptyQuery()
Returns a flag, indicating if search should be performed using a wildcard if the empty query is given.java.util.Locale
getSearchLocale()
Gets the search locale.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.java.util.Map<java.lang.String,I_CmsSearchConfigurationFacetField>
parseFieldFacets()
Returns the configuration for the field facets.I_CmsSearchConfigurationPagination
parsePagination()
Returns the configuration for the pagination.java.util.Map<java.lang.String,I_CmsSearchConfigurationFacetRange>
parseRangeFacets()
Returns the configuration for the range facets.void
setIgnoreBlacklist(boolean ignoreBlacklist)
Sets the 'ignore blacklist' flag.void
setPagination(I_CmsSearchConfigurationPagination pagination)
Sets the pagination.void
setSearchLocale(java.util.Locale locale)
Sets the search locale.void
setSortOption(java.lang.String sortOption)
Sets the sort option.-
Methods inherited from class org.opencms.jsp.search.config.parser.CmsJSONSearchConfigurationParser
getAdditionalParameters, getCore, getFirstCallParam, getIgnoreQuery, getIndex, getLastQueryParam, getPageNavLength, getPageParam, getPageSizes, getQueryParam, getSortParam, init, parseCommon, parseDidYouMean, parseFacetQueryItem, parseFacetQueryItems, parseFieldFacet, parseGeoFilter, parseHighlighter, parseMandatoryStringValues, parseOptionalBooleanValue, parseOptionalIntValue, parseOptionalStringValue, parseOptionalStringValues, parseQueryFacet, parseRangeFacet, parseSorting, parseSortOption
-
-
-
-
Field Detail
-
FIELD_CATEGORIES
public static final java.lang.String FIELD_CATEGORIES
SOLR field name.- See Also:
- Constant Field Values
-
FIELD_DATE
public static final java.lang.String FIELD_DATE
SOLR field name.- See Also:
- Constant Field Values
-
FIELD_DATE_RANGE
public static final java.lang.String FIELD_DATE_RANGE
SOLR field name.- See Also:
- Constant Field Values
-
FIELD_DATE_FACET_NAME
public static final java.lang.String FIELD_DATE_FACET_NAME
SOLR field name.- See Also:
- Constant Field Values
-
FIELD_PARENT_FOLDERS
public static final java.lang.String FIELD_PARENT_FOLDERS
SOLR field name.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CmsSimpleSearchConfigurationParser
public CmsSimpleSearchConfigurationParser(CmsObject cms, CmsConfigurationBean config, java.lang.String additionalParamJSON) throws JSONException
Constructor.- Parameters:
cms
- the cms contextconfig
- the list configurationadditionalParamJSON
- the additional JSON configuration- Throws:
JSONException
- in case parsing the JSON fails
-
-
Method Detail
-
createInstanceWithNoJsonConfig
public static CmsSimpleSearchConfigurationParser createInstanceWithNoJsonConfig(CmsObject cms, CmsConfigurationBean config)
Creates an instance for an empty JSON configuration.The point of this is that we know that passing an empty configuration makes it impossible for a JSONException to thrown.
- Parameters:
cms
- the current CMS contextconfig
- the search configuration- Returns:
- the search config parser
-
getInitialQuery
public CmsSolrQuery getInitialQuery()
Returns the initial SOLR query.- Returns:
- the SOLR query
-
getSearchLocale
public java.util.Locale getSearchLocale()
Gets the search locale.- Returns:
- the search locale
-
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
- Overrides:
parseFieldFacets
in classCmsJSONSearchConfigurationParser
- Returns:
- The configuration for the field facets.
- See Also:
I_CmsSearchConfigurationParser.parseFieldFacets()
-
parsePagination
public I_CmsSearchConfigurationPagination parsePagination()
Description copied from interface:I_CmsSearchConfigurationParser
Returns the configuration for the pagination.- Specified by:
parsePagination
in interfaceI_CmsSearchConfigurationParser
- Overrides:
parsePagination
in classCmsJSONSearchConfigurationParser
- Returns:
- The configuration for the pagination.
- See Also:
CmsJSONSearchConfigurationParser.parsePagination()
-
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
- Overrides:
parseRangeFacets
in classCmsJSONSearchConfigurationParser
- Returns:
- The configuration for the range facets.
- See Also:
I_CmsSearchConfigurationParser.parseRangeFacets()
-
setIgnoreBlacklist
public void setIgnoreBlacklist(boolean ignoreBlacklist)
Sets the 'ignore blacklist' flag.If set, the search will ignore the blacklist from the list configuration.
- Parameters:
ignoreBlacklist
- true if the blacklist should be ignored
-
setPagination
public void setPagination(I_CmsSearchConfigurationPagination pagination)
Sets the pagination.If this is set, parsePagination will always return the set value instead of using the default way to compute the pagination
- Parameters:
pagination
- the pagination
-
setSearchLocale
public void setSearchLocale(java.util.Locale locale)
Sets the search locale.- Parameters:
locale
- the search locale
-
setSortOption
public void setSortOption(java.lang.String sortOption)
Sets the sort option.- Parameters:
sortOption
- the sort option
-
getEscapeQueryChars
protected java.lang.Boolean getEscapeQueryChars()
Description copied from class:CmsJSONSearchConfigurationParser
Returns the flag, indicating if the characters in the query string that are commands to Solr should be escaped.- Overrides:
getEscapeQueryChars
in classCmsJSONSearchConfigurationParser
- Returns:
- the flag, indicating if the characters in the query string that are commands to Solr should be escaped.
- See Also:
CmsJSONSearchConfigurationParser.getEscapeQueryChars()
-
getExtraSolrParams
protected java.lang.String getExtraSolrParams()
Description copied from class:CmsJSONSearchConfigurationParser
Returns the configured extra parameters that should be given to Solr, or the empty string if no parameters are configured.- Overrides:
getExtraSolrParams
in classCmsJSONSearchConfigurationParser
- Returns:
- The configured extra parameters that should be given to Solr, or the empty string if no parameters are configured.
- See Also:
CmsJSONSearchConfigurationParser.getExtraSolrParams()
-
getIgnoreExpirationDate
protected java.lang.Boolean getIgnoreExpirationDate()
Description copied from class:CmsJSONSearchConfigurationParser
Returns a flag indicating if also expired resources should be found.- Overrides:
getIgnoreExpirationDate
in classCmsJSONSearchConfigurationParser
- Returns:
- A flag indicating if also expired resources should be found.
- See Also:
CmsJSONSearchConfigurationParser.getIgnoreExpirationDate()
-
getIgnoreReleaseDate
protected java.lang.Boolean getIgnoreReleaseDate()
Description copied from class:CmsJSONSearchConfigurationParser
Returns a flag indicating if also unreleased resources should be found.- Overrides:
getIgnoreReleaseDate
in classCmsJSONSearchConfigurationParser
- Returns:
- A flag indicating if also unreleased resources should be found.
- See Also:
CmsJSONSearchConfigurationParser.getIgnoreReleaseDate()
-
getMaxReturnedResults
protected int getMaxReturnedResults(java.lang.String indexName)
Description copied from class:CmsJSONSearchConfigurationParser
Returns the number of maximally returned results, ornull
if the indexes default should be used.- Overrides:
getMaxReturnedResults
in classCmsJSONSearchConfigurationParser
- 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. - See Also:
CmsJSONSearchConfigurationParser.getMaxReturnedResults(java.lang.String)
-
getQueryModifier
protected java.lang.String getQueryModifier()
Description copied from class:CmsJSONSearchConfigurationParser
Returns the optional query modifier.- Overrides:
getQueryModifier
in classCmsJSONSearchConfigurationParser
- Returns:
- the optional query modifier.
- See Also:
CmsJSONSearchConfigurationParser.getQueryModifier()
-
getSearchForEmptyQuery
protected java.lang.Boolean getSearchForEmptyQuery()
Description copied from class:CmsJSONSearchConfigurationParser
Returns a flag, indicating if search should be performed using a wildcard if the empty query is given.- Overrides:
getSearchForEmptyQuery
in classCmsJSONSearchConfigurationParser
- Returns:
- A flag, indicating if search should be performed using a wildcard if the empty query is given.
- See Also:
CmsJSONSearchConfigurationParser.getSearchForEmptyQuery()
-
getSortOptions
protected java.util.List<I_CmsSearchConfigurationSortOption> getSortOptions()
Description copied from class:CmsJSONSearchConfigurationParser
Returns the list of the configured sort options, or the empty list if no sort options are configured.- Overrides:
getSortOptions
in classCmsJSONSearchConfigurationParser
- Returns:
- The list of the configured sort options, or the empty list if no sort options are configured.
- See Also:
CmsJSONSearchConfigurationParser.getSortOptions()
-
-