com.atlassian.jira.util
Class LuceneUtils

java.lang.Object
  extended by com.atlassian.jira.util.LuceneUtils

public class LuceneUtils
extends Object

A simple utility class for our common Lucene usage methods.


Method Summary
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)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

localDateToString

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

stringToLocalDate

public static LocalDate stringToLocalDate(String indexValue)

dateToString

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

stringToDate

public static Date stringToDate(String s)


Copyright © 2002-2014 Atlassian. All Rights Reserved.