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)
           
static org.apache.lucene.index.IndexReader getIndexReader(String path)
           
static org.apache.lucene.index.IndexWriter getIndexWriter(String path, boolean create, org.apache.lucene.analysis.Analyzer analyzer)
           
static Collection<String> getStaleLockPaths(Collection<String> indexDirectoryPaths)
          Given a Collection of paths that represent index directories checks if there are any existing Lucene lock files for the passed paths.
static Date stringToDate(String s)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getIndexReader

public static org.apache.lucene.index.IndexReader getIndexReader(String path)
                                                          throws IndexException
Throws:
IndexException

getIndexWriter

public static org.apache.lucene.index.IndexWriter getIndexWriter(String path,
                                                                 boolean create,
                                                                 org.apache.lucene.analysis.Analyzer analyzer)
                                                          throws IndexException
Throws:
IndexException

getStaleLockPaths

public static Collection<String> getStaleLockPaths(Collection<String> indexDirectoryPaths)
Given a Collection of paths that represent index directories checks if there are any existing Lucene lock files for the passed paths. This method returns a Collection of file paths of any existing Lucene lock files. If no lock files are found an empty collection is returned.

A common usage of this methdo would be:

 Collection existingLockFilepaths = LuceneUtils.getStaleLockPaths(indexManager.getAllIndexPaths());
 

Parameters:
indexDirectoryPaths - collection of index directory paths
Returns:
collection of file paths of any existing Lucene lock files

dateToString

public static String dateToString(Date date)

stringToDate

public static Date stringToDate(String s)


Copyright © 2002-2009 Atlassian. All Rights Reserved.