org.apache.jackrabbit.core.query.lucene
Class Util

java.lang.Object
  extended by org.apache.jackrabbit.core.query.lucene.Util

public class Util
extends Object

Util provides various static utility methods.


Constructor Summary
Util()
           
 
Method Summary
static void closeOrRelease(org.apache.lucene.index.IndexReader reader)
          Depending on the type of the reader this method either closes or releases the reader.
static IOException createIOException(Throwable t)
          Creates an IOException with t as its cause.
static org.apache.lucene.search.Query createMatchAllQuery(String name, IndexFormatVersion version)
          Depending on the index format this method returns a query that matches all nodes that have a property with a given name.
static void disposeDocument(org.apache.lucene.document.Document old)
          Disposes the document old.
static boolean isDocumentReady(org.apache.lucene.document.Document doc)
          Returns true if the document is ready to be added to the index.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Util

public Util()
Method Detail

disposeDocument

public static void disposeDocument(org.apache.lucene.document.Document old)
Disposes the document old. Closes any potentially open readers held by the document.

Parameters:
old - the document to dispose.

isDocumentReady

public static boolean isDocumentReady(org.apache.lucene.document.Document doc)
Returns true if the document is ready to be added to the index. That is all text extractors have finished their work.

Parameters:
doc - the document to check.
Returns:
true if the document is ready; false otherwise.

createMatchAllQuery

public static org.apache.lucene.search.Query createMatchAllQuery(String name,
                                                                 IndexFormatVersion version)
Depending on the index format this method returns a query that matches all nodes that have a property with a given name.

Parameters:
name - the property name.
version - the index format version.
Returns:
Query that matches all nodes that have a property with the given name.

createIOException

public static IOException createIOException(Throwable t)
Creates an IOException with t as its cause.

Parameters:
t - the cause.

closeOrRelease

public static void closeOrRelease(org.apache.lucene.index.IndexReader reader)
                           throws IOException
Depending on the type of the reader this method either closes or releases the reader. The reader is released if it implements ReleaseableIndexReader.

Parameters:
reader - the index reader to close or release.
Throws:
IOException - if an error occurs while closing or releasing the index reader.


Copyright © 2004-2008 The Apache Software Foundation. All Rights Reserved.