org.opencms.search
Class CmsLuceneIndexWriter

java.lang.Object
  extended by org.opencms.search.CmsLuceneIndexWriter
All Implemented Interfaces:
I_CmsIndexWriter

public class CmsLuceneIndexWriter
extends Object
implements I_CmsIndexWriter

Delegates indexing to a standard Lucene IndexWriter.

Since:
8.0.2

Field Summary
static int COMMIT_OPTIMIZE_THRESHOLD
          The threshold for the commits until optimize is called.
protected static org.apache.commons.logging.Log LOG
          The log object for this class.
 
Constructor Summary
CmsLuceneIndexWriter(org.apache.lucene.index.IndexWriter indexWriter)
          Creates a new index writer based on the provided standard Lucene IndexWriter.
CmsLuceneIndexWriter(org.apache.lucene.index.IndexWriter indexWriter, CmsSearchIndex index)
          Creates a new index writer based on the provided standard Lucene IndexWriter for the provided OpenCms search index instance.
 
Method Summary
 void close()
          Close this IndexWriter.
 void commit()
          Commit all previous operations.
 void deleteDocuments(String rootPath)
          Delete a document from the index.
 void optimize()
          Optimizes the index.
 void updateDocument(String rootPath, org.apache.lucene.document.Document document)
          Update a document in the index.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COMMIT_OPTIMIZE_THRESHOLD

public static final int COMMIT_OPTIMIZE_THRESHOLD
The threshold for the commits until optimize is called.

See Also:
Constant Field Values

LOG

protected static final org.apache.commons.logging.Log LOG
The log object for this class.

Constructor Detail

CmsLuceneIndexWriter

public CmsLuceneIndexWriter(org.apache.lucene.index.IndexWriter indexWriter)
Creates a new index writer based on the provided standard Lucene IndexWriter.

Parameters:
indexWriter - the standard Lucene IndexWriter to use as delegate

CmsLuceneIndexWriter

public CmsLuceneIndexWriter(org.apache.lucene.index.IndexWriter indexWriter,
                            CmsSearchIndex index)
Creates a new index writer based on the provided standard Lucene IndexWriter for the provided OpenCms search index instance.

The OpenCms search instance is currently used only for improved logging of the index operations.

Parameters:
indexWriter - the standard Lucene IndexWriter to use as delegate
index - the OpenCms search index instance this writer to supposed to write to
Method Detail

close

public void close()
           throws IOException
Description copied from interface: I_CmsIndexWriter
Close this IndexWriter.

Specified by:
close in interface I_CmsIndexWriter
Throws:
IOException
See Also:
I_CmsIndexWriter.close()

commit

public void commit()
            throws IOException
Description copied from interface: I_CmsIndexWriter
Commit all previous operations.

Specified by:
commit in interface I_CmsIndexWriter
Throws:
IOException
See Also:
I_CmsIndexWriter.commit()

deleteDocuments

public void deleteDocuments(String rootPath)
                     throws IOException
Description copied from interface: I_CmsIndexWriter
Delete a document from the index.

Specified by:
deleteDocuments in interface I_CmsIndexWriter
Parameters:
rootPath - the root path of the document to delete
Throws:
IOException - in case something goes wrong
See Also:
I_CmsIndexWriter.deleteDocuments(java.lang.String)

optimize

public void optimize()
              throws IOException
Description copied from interface: I_CmsIndexWriter
Optimizes the index.

Specified by:
optimize in interface I_CmsIndexWriter
Throws:
IOException
See Also:
I_CmsIndexWriter.optimize()

updateDocument

public void updateDocument(String rootPath,
                           org.apache.lucene.document.Document document)
                    throws IOException
Description copied from interface: I_CmsIndexWriter
Update a document in the index.

Specified by:
updateDocument in interface I_CmsIndexWriter
Parameters:
rootPath - the root path of the document to update
document - the document to update
Throws:
IOException - in case something goes wrong
See Also:
I_CmsIndexWriter.updateDocument(java.lang.String, org.apache.lucene.document.Document)