Java org.apache.lucene.index IndexWriter fields, constructors, methods, implement or subclass

Example usage for Java org.apache.lucene.index IndexWriter fields, constructors, methods, implement or subclass

Introduction

In this page you can find the methods, fields and constructors for org.apache.lucene.index IndexWriter.

The text is from its open source code.

Subclass

org.apache.lucene.index.IndexWriter has subclasses.
Click this link to see all its subclasses.

Field

intMAX_DOCS
Hard limit on maximum number of documents that may be added to the index.
StringWRITE_LOCK_NAME
Name of the write lock in the index.
StringSOURCE
Key for the source of a segment in the SegmentInfo#getDiagnostics() diagnostics .
StringSOURCE_MERGE
Source of a segment which results from a merge of other segments.
StringSOURCE_FLUSH
Source of a segment which results from a flush.
StringSOURCE_ADDINDEXES_READERS
Source of a segment which results from a call to #addIndexes(CodecReader) .
intMAX_TERM_LENGTH
Absolute hard maximum length for a term, in bytes once encoded as UTF8.
AtomicBooleanmaybeMerge

Constructor

IndexWriter(Directory d, IndexWriterConfig conf)
Constructs a new IndexWriter per the settings given in conf.

Method

voidabortMerges()
Aborts running merges.
longaddDocument(Iterable doc)
Adds a document to this index.
longaddDocuments(Iterable> docs)
Atomically adds a block of documents with sequentially assigned document IDs, such that an external reader will see all or none of the documents.
longaddIndexes(Directory... dirs)
Adds all segments from an array of indexes into this index.
longaddIndexes(CodecReader... readers)
Merges the provided indexes into this index.
voidclose()
Closes all open resources and releases the write lock.
longcommit()

Commits all pending changes (added and deleted documents, segment merges, added indexes, etc.) to the index, and syncs all referenced index files, such that a reader will see the changes and the index updates will survive an OS or machine crash or power loss.

longdeleteAll()
Delete all documents in the index.
longdeleteDocuments(Term... terms)
Deletes the document(s) containing any of the terms.
longdeleteDocuments(Query... queries)
Deletes the document(s) matching any of the provided queries.
voiddeleteUnusedFiles()
Expert: remove any index files that are no longer used.
voidflush()
Moves all in-memory segments to the Directory , but does not commit (fsync) them (call #commit for that).
voidforceMerge(int maxNumSegments)
Forces merge policy to merge segments until there are <= maxNumSegments .
voidforceMerge(int maxNumSegments, boolean doWait)
Just like #forceMerge(int) , except you can specify whether the call should block until all merging completes.
voidforceMergeDeletes()
Forces merging of all segments that have deleted documents.
voidforceMergeDeletes(boolean doWait)
Just like #forceMergeDeletes() , except you can specify whether the call should block until the operation completes.
AnalyzergetAnalyzer()
Returns the analyzer used by this index.
LiveIndexWriterConfiggetConfig()
Returns a LiveIndexWriterConfig , which can be used to query the IndexWriter current settings, as well as modify "live" ones.
DirectorygetDirectory()
Returns the Directory used by this index.
Iterable>getLiveCommitData()
Returns the commit user data iterable previously set with #setLiveCommitData(Iterable) , or null if nothing has been set yet.
MergePolicy.OneMergegetNextMerge()
Expert: the MergeScheduler calls this method to retrieve the next merge requested by the MergePolicy
DirectoryReadergetReader()
booleanhasDeletions()
Returns true if this index has deletions (including buffered deletions).
booleanhasPendingMerges()
Expert: returns true if there are merges waiting to be scheduled.
booleanhasUncommittedChanges()
Returns true if there may be changes that have not been committed.
booleanisOpen()
Returns true if this IndexWriter is still open.
voidmerge(MergePolicy.OneMerge merge)
Merges the indicated segments, replacing them in the stack with a single segment.
intnumDeletedDocs(SegmentCommitInfo info)
Obtain the number of deleted docs for a pooled reader.
intnumRamDocs()
Expert: Return the number of documents currently buffered in RAM.
longprepareCommit()

Expert: prepare for commit.

longramBytesUsed()
voidrollback()
Close the IndexWriter without committing any changes that have occurred since the last commit (or since it was opened, if commit hasn't been called).
StringsegString()
Returns a string description of all segments, for debugging.
voidsetLiveCommitData(Iterable> commitUserData)
Sets the iterator to provide the commit user data map at commit time.
longtryDeleteDocument(IndexReader readerIn, int docID)
Expert: attempts to delete by document ID, as long as the provided reader is a near-real-time reader (from DirectoryReader#open(IndexWriter) ).
longupdateDocument(Term term, Iterable doc)
Updates a document by first deleting the document(s) containing term and then adding the new document.
longupdateDocument(final DocumentsWriterDeleteQueue.Node delNode, Iterable doc)
longupdateDocuments(Term delTerm, Iterable> docs)
Atomically deletes documents matching the provided delTerm and adds a block of documents with sequentially assigned document IDs, such that an external reader will see all or none of the documents.
longupdateDocuments(final DocumentsWriterDeleteQueue.Node delNode, Iterable> docs)
longupdateDocValues(Term term, Field... updates)
Updates documents' DocValues fields to the given values.
longupdateNumericDocValue(Term term, String field, long value)
Updates a document's NumericDocValues for field to the given value.
voidwaitForMerges()
Wait for any currently outstanding merges to finish.