public static String getDateCreatedTimeRangeFilterQuery ( String searchField , long startTime , long endTime ) { String sStartTime = null ; String sEndTime = null ; // Convert startTime to ISO 8601 format if ( ( startTime > Long . MIN_VALUE ) && ( startTime < Long . MAX_VALUE ) ) { sStartTime = CmsSearchUtil . getDateAsIso8601 ( new Date ( startTime ) ) ; } // Convert endTime to ISO 8601 format if ( ( endTime > Long . MIN_VALUE ) && ( endTime < Long . MAX_VALUE ) ) { sEndTime = CmsSearchUtil . getDateAsIso8601 ( new Date ( endTime ) ) ; } // Build Solr range string final String rangeString = CmsSearchUtil . getSolrRangeString ( sStartTime , sEndTime ) ; // Build Solr filter string return String . format ( "%s:%s" , searchField , rangeString ) ; }
Returns a time interval as Solr compatible query string .