public class LuceneUtils extends Object
Some logic copied from DateTools
in Lucene 4.4. Done to maintain Lucene independent assumptions about how dates should be formatted for indexing.
This is required as there are many implicit baked in assumptions about date formatting around confluence, we don't want to it change in future.
Modifier and Type | Class and Description |
---|---|
static class |
LuceneUtils.Resolution
Specifies the time granularity.
|
Constructor and Description |
---|
LuceneUtils() |
Modifier and Type | Method and Description |
---|---|
static String |
dateToString(Date date)
Converts a Date into a String using the Lucene index format, with a millisecond resolution.
|
static String |
dateToString(Date date,
LuceneUtils.Resolution resolution)
Converts a Date to a string suitable for indexing.
|
static Date |
stringToDate(String s)
Converts a String from the Lucene index format into a Date.
|
public static String dateToString(Date date)
dateToString(java.util.Date)
public static String dateToString(Date date, LuceneUtils.Resolution resolution)
date
- the date to be convertedresolution
- the desired resolutionyyyyMMddHHmmssSSS
or shorter,
depending on resolution
; using GMT as timezonepublic static Date stringToDate(String s)
Copyright © 2003–2023 Atlassian. All rights reserved.
View cookie preferences