Example usage for Java org.apache.lucene.index IndexWriter fields, constructors, methods, implement or subclass
The text is from its open source code.
int | MAX_DOCS Hard limit on maximum number of documents that may be added to the index. |
String | WRITE_LOCK_NAME Name of the write lock in the index. |
String | SOURCE Key for the source of a segment in the SegmentInfo#getDiagnostics() diagnostics . |
String | SOURCE_MERGE Source of a segment which results from a merge of other segments. |
String | SOURCE_FLUSH Source of a segment which results from a flush. |
String | SOURCE_ADDINDEXES_READERS Source of a segment which results from a call to #addIndexes(CodecReader) . |
int | MAX_TERM_LENGTH Absolute hard maximum length for a term, in bytes once encoded as UTF8. |
AtomicBoolean | maybeMerge |
IndexWriter(Directory d, IndexWriterConfig conf) Constructs a new IndexWriter per the settings given in conf . |
void | abortMerges() Aborts running merges. |
long | addDocument(Iterable extends IndexableField> doc) Adds a document to this index. |
long | addDocuments(Iterable extends Iterable extends IndexableField>> 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. |
long | addIndexes(Directory... dirs) Adds all segments from an array of indexes into this index. |
long | addIndexes(CodecReader... readers) Merges the provided indexes into this index. |
void | close() Closes all open resources and releases the write lock. |
long | commit() 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. |
long | deleteAll() Delete all documents in the index. |
long | deleteDocuments(Term... terms) Deletes the document(s) containing any of the terms. |
long | deleteDocuments(Query... queries) Deletes the document(s) matching any of the provided queries. |
void | deleteUnusedFiles() Expert: remove any index files that are no longer used. |
void | flush() Moves all in-memory segments to the Directory , but does not commit (fsync) them (call #commit for that). |
void | forceMerge(int maxNumSegments) Forces merge policy to merge segments until there are <= maxNumSegments . |
void | forceMerge(int maxNumSegments, boolean doWait) Just like #forceMerge(int) , except you can specify whether the call should block until all merging completes. |
void | forceMergeDeletes() Forces merging of all segments that have deleted documents. |
void | forceMergeDeletes(boolean doWait) Just like #forceMergeDeletes() , except you can specify whether the call should block until the operation completes. |
Analyzer | getAnalyzer() Returns the analyzer used by this index. |
LiveIndexWriterConfig | getConfig() Returns a LiveIndexWriterConfig , which can be used to query the IndexWriter current settings, as well as modify "live" ones. |
Directory | getDirectory() 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.OneMerge | getNextMerge() Expert: the MergeScheduler calls this method to retrieve the next merge requested by the MergePolicy |
DirectoryReader | getReader() |
boolean | hasDeletions() Returns true if this index has deletions (including buffered deletions). |
boolean | hasPendingMerges() Expert: returns true if there are merges waiting to be scheduled. |
boolean | hasUncommittedChanges() Returns true if there may be changes that have not been committed. |
boolean | isOpen() Returns true if this IndexWriter is still open. |
void | merge(MergePolicy.OneMerge merge) Merges the indicated segments, replacing them in the stack with a single segment. |
int | numDeletedDocs(SegmentCommitInfo info) Obtain the number of deleted docs for a pooled reader. |
int | numRamDocs() Expert: Return the number of documents currently buffered in RAM. |
long | prepareCommit() Expert: prepare for commit. |
long | ramBytesUsed() |
void | rollback() 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). |
String | segString() Returns a string description of all segments, for debugging. |
void | setLiveCommitData(Iterable Sets the iterator to provide the commit user data map at commit time. |
long | tryDeleteDocument(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) ). |
long | updateDocument(Term term, Iterable extends IndexableField> doc) Updates a document by first deleting the document(s) containing term and then adding the new document. |
long | updateDocument(final DocumentsWriterDeleteQueue.Node> delNode, Iterable extends IndexableField> doc) |
long | updateDocuments(Term delTerm, Iterable extends Iterable extends IndexableField>> 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. |
long | updateDocuments(final DocumentsWriterDeleteQueue.Node> delNode, Iterable extends Iterable extends IndexableField>> docs) |
long | updateDocValues(Term term, Field... updates) Updates documents' DocValues fields to the given values. |
long | updateNumericDocValue(Term term, String field, long value) Updates a document's NumericDocValues for field to the given value . |
void | waitForMerges() Wait for any currently outstanding merges to finish. |