public class CmsSolrIndexWriter extends java.lang.Object implements I_CmsSolrIndexWriter
Modifier and Type | Field and Description |
---|---|
protected static org.apache.commons.logging.Log |
LOG
The log object for this class.
|
Constructor and Description |
---|
CmsSolrIndexWriter(org.apache.solr.client.solrj.SolrClient client)
Constructor to create a Solr index writer.
|
CmsSolrIndexWriter(org.apache.solr.client.solrj.SolrClient client,
CmsSolrIndex index)
Creates a new index writer based on the provided standard Lucene IndexWriter for the
provided OpenCms search index instance.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Close this IndexWriter.
|
void |
commit()
Commit all previous operations.
|
void |
deleteAllDocuments()
Deletes all documents of the index belonging to this index writer.
|
void |
deleteDocument(CmsPublishedResource resource)
Delete a document from the index.
|
void |
optimize()
Optimizes the index.
|
void |
updateDocument(java.lang.String rootPath,
I_CmsSearchDocument document)
Update a document in the index.
|
protected static final org.apache.commons.logging.Log LOG
public CmsSolrIndexWriter(org.apache.solr.client.solrj.SolrClient client)
client
- the client to usepublic CmsSolrIndexWriter(org.apache.solr.client.solrj.SolrClient client, CmsSolrIndex index)
The OpenCms search instance is currently used only for improved logging of the index operations.
client
- the standard Lucene IndexWriter to use as delegateindex
- the OpenCms search index instance this writer to supposed to write topublic void close()
I_CmsIndexWriter
close
in interface I_CmsIndexWriter
I_CmsIndexWriter.close()
public void commit() throws java.io.IOException
I_CmsIndexWriter
commit
in interface I_CmsIndexWriter
java.io.IOException
- thrown if the commit action fails.I_CmsIndexWriter.commit()
public void deleteAllDocuments() throws java.io.IOException
I_CmsSolrIndexWriter
deleteAllDocuments
in interface I_CmsSolrIndexWriter
java.io.IOException
- if something goes wrongI_CmsSolrIndexWriter.deleteAllDocuments()
public void deleteDocument(CmsPublishedResource resource) throws java.io.IOException
I_CmsIndexWriter
deleteDocument
in interface I_CmsIndexWriter
resource
- the resource to deletejava.io.IOException
- in case something goes wrongI_CmsIndexWriter.deleteDocument(org.opencms.db.CmsPublishedResource)
public void optimize()
I_CmsIndexWriter
Please note that as of Lucene 3.5, the direct use of optimize is discouraged as Lucene apparently is now able to manage the file structure so efficiently that frequent optimizations are not longer required.
optimize
in interface I_CmsIndexWriter
I_CmsIndexWriter.optimize()
public void updateDocument(java.lang.String rootPath, I_CmsSearchDocument document) throws java.io.IOException
I_CmsIndexWriter
updateDocument
in interface I_CmsIndexWriter
rootPath
- the root path of the document to updatedocument
- the document to updatejava.io.IOException
- in case something goes wrongI_CmsIndexWriter.updateDocument(java.lang.String, org.opencms.search.I_CmsSearchDocument)