com.atlassian.jira.util
Class LuceneUtils

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

public class LuceneUtils
extends java.lang.Object

A simple utility class for our common Lucene usage methods.


Method Summary
static java.lang.String dateToString(java.util.Date date)
           
static org.apache.lucene.store.Directory getDirectory(java.lang.String path)
           
static org.apache.lucene.index.IndexReader getIndexReader(java.lang.String path)
           
static org.apache.lucene.index.IndexWriter getIndexWriter(java.lang.String path, boolean create, org.apache.lucene.analysis.Analyzer analyzer)
           
static java.util.Collection<java.lang.String> getStaleLockPaths(java.util.Collection<java.lang.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 java.util.Date stringToDate(java.lang.String s)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getDirectory

public static org.apache.lucene.store.Directory getDirectory(java.lang.String path)

getIndexReader

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

getIndexWriter

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

getStaleLockPaths

public static java.util.Collection<java.lang.String> getStaleLockPaths(java.util.Collection<java.lang.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 java.lang.String dateToString(java.util.Date date)

stringToDate

public static java.util.Date stringToDate(java.lang.String s)


Copyright © 2002-2010 Atlassian. All Rights Reserved.