public final class CmsSearchUtil extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static java.util.Collection<java.lang.String> |
DEFAULT_DATE_FORMATS
A suite of default date formats that can be parsed, and thus transformed to the Solr specific format
|
static java.lang.String |
PATTERN_ASCTIME
Date format pattern used to parse HTTP date headers in ANSI C
asctime() format. |
static java.lang.String |
PATTERN_RFC1036
Date format pattern used to parse HTTP date headers in RFC 1036 format.
|
static java.lang.String |
PATTERN_RFC1123
Date format pattern used to parse HTTP date headers in RFC 1123 format.
|
static java.util.TimeZone |
TIMEZONE_GMT
Variable to hold an GMT timezone object.
|
static java.util.TimeZone |
TIMEZONE_UTC
Variable to hold an UTC timezone object.
|
| Modifier and Type | Method and Description |
|---|---|
static java.util.List<java.lang.String> |
computeScopeFolders(CmsObject cms,
CmsGallerySearchParameters params)
Computes the search root folders for the given search parameters based on the search scope.
|
static java.lang.String |
getDateAsIso8601(java.util.Date date)
Returns a given date object in the ISO 8601 format.
|
static java.lang.String |
getDateAsIso8601(long date)
Returns a given date object in the ISO 8601 format.
|
static java.lang.String |
getDateCreatedTimeRangeFilterQuery(java.lang.String searchField,
long startTime,
long endTime)
Returns a time interval as Solr compatible query string.
|
static java.util.List<java.lang.String> |
getSearchRootsForScope(CmsGallerySearchScope scope,
java.lang.String siteParam,
java.lang.String subSiteParam)
Gets the search roots to use for the given site/subsite parameters.
|
static java.lang.String |
getSolrRangeString(java.lang.String from,
java.lang.String to)
Returns a string that represents a valid Solr query range.
|
static java.util.Date |
parseDate(java.lang.String d)
Returns a formatter that can be use by the current thread if needed to
convert Date objects to the Internal representation.
|
static java.util.Date |
parseDate(java.lang.String d,
java.util.Collection<java.lang.String> fmts) |
static java.util.Date |
parseDate(java.lang.String dateValue,
java.util.Collection<java.lang.String> dateFormats,
java.util.Date startDate)
Slightly modified from org.apache.commons.httpclient.util.DateUtil.parseDate
Parses the date value using the given date formats.
|
static java.lang.String |
stripHtmlFromPropertyIfNecessary(java.lang.String propertyName,
java.lang.String value)
Strips of HTML of the value to map, if necessary (depending on the property name).
|
static java.util.Collection<org.apache.solr.common.util.ContentStream> |
toContentStreams(java.lang.String str,
java.lang.String contentType)
Take a string and make it an iterable ContentStream
|
static org.apache.solr.common.SolrDocument |
toSolrDocument(org.apache.solr.common.SolrInputDocument d)
Deprecated.
This method will be removed in Solr 6.0
|
static org.apache.solr.common.SolrInputDocument |
toSolrInputDocument(org.apache.solr.common.SolrDocument d)
Deprecated.
This method will be removed in Solr 6.0
|
public static final java.util.TimeZone TIMEZONE_UTC
public static final java.util.TimeZone TIMEZONE_GMT
public static final java.lang.String PATTERN_RFC1123
public static final java.lang.String PATTERN_RFC1036
public static final java.lang.String PATTERN_ASCTIME
asctime() format.public static final java.util.Collection<java.lang.String> DEFAULT_DATE_FORMATS
public static java.util.List<java.lang.String> computeScopeFolders(CmsObject cms, CmsGallerySearchParameters params)
cms - the current CMS contextparams - the current search parameterspublic static java.lang.String getDateAsIso8601(java.util.Date date)
date - that should be converted.public static java.lang.String getDateAsIso8601(long date)
date - that should be converted.public static java.lang.String getDateCreatedTimeRangeFilterQuery(java.lang.String searchField, long startTime, long endTime)
searchField - the field to search for.startTime - the lower limit of the interval.endTime - the upper limit of the interval.public static java.util.List<java.lang.String> getSearchRootsForScope(CmsGallerySearchScope scope, java.lang.String siteParam, java.lang.String subSiteParam)
scope - the search scopesiteParam - the current sitesubSiteParam - the current subsitepublic static java.lang.String getSolrRangeString(java.lang.String from, java.lang.String to)
from - Lower bound of the query range.to - Upper bound of the query range.public static java.util.Date parseDate(java.lang.String d) throws java.text.ParseException
d - The input date to parseDatejava.text.ParseException - If the input can't be parsedpublic static java.util.Date parseDate(java.lang.String d, java.util.Collection<java.lang.String> fmts) throws java.text.ParseException
java.text.ParseExceptionpublic static java.util.Date parseDate(java.lang.String dateValue, java.util.Collection<java.lang.String> dateFormats, java.util.Date startDate) throws java.text.ParseException
Parses the date value using the given date formats.
dateValue - the date value to parsedateFormats - the date formats to usestartDate - During parsing, two digit years will be placed in the range
startDate to startDate + 100 years. This value may
be null. When null is given as a parameter, year
2000 will be used.java.text.ParseException - if none of the dataFormats could parse the dateValuepublic static java.lang.String stripHtmlFromPropertyIfNecessary(java.lang.String propertyName, java.lang.String value)
propertyName - name of the property.value - the properties value (possibly with HTML)public static java.util.Collection<org.apache.solr.common.util.ContentStream> toContentStreams(java.lang.String str, java.lang.String contentType)
@Deprecated public static org.apache.solr.common.SolrDocument toSolrDocument(org.apache.solr.common.SolrInputDocument d)
d - SolrInputDocument to convert@Deprecated public static org.apache.solr.common.SolrInputDocument toSolrInputDocument(org.apache.solr.common.SolrDocument d)
d - SolrDocument to convert