public class

LuceneUtils

extends Object
java.lang.Object
   ↳ com.atlassian.jira.util.LuceneUtils

Class Overview

A simple utility class for our common Lucene usage methods.

Summary

Public Methods
static String dateToString(Date date)
Turns a given date-time (point in time) value into a String suitable for storing and searching in Lucene.
static String localDateToString(LocalDate localDate)
Turns a given LocalDate value into a String suitable for storing and searching in Lucene.
static Date stringToDate(String s)
static LocalDate stringToLocalDate(String indexValue)
[Expand]
Inherited Methods
From class java.lang.Object

Public Methods

public static String dateToString (Date date)

Turns a given date-time (point in time) value into a String suitable for storing and searching in Lucene.

The date-time is stored as the number of seconds. If the date is null we store the encoded form of Long.MAX_VALUE which causes nulls to sort to the end. (This is traditional JIRA behaviour)

Parameters
date the date to be converted. May be null
Returns
  • a string representing the number of seconds

public static String localDateToString (LocalDate localDate)

Turns a given LocalDate value into a String suitable for storing and searching in Lucene.

The date is stored as "YYYYMMDD". If the date is null we store "99999999" which causes nulls to sort to the end. (This is traditional JIRA behaviour)

Parameters
localDate the date to be converted. May be null
Returns
  • a string representing the date

public static Date stringToDate (String s)

public static LocalDate stringToLocalDate (String indexValue)