org.apache.lucene.index
Class TrackingIndexWriter

java.lang.Object
  extended by org.apache.lucene.index.TrackingIndexWriter

public class TrackingIndexWriter
extends Object

Class that tracks changes to a delegated IndexWriter, used by ControlledRealTimeReopenThread to ensure specific changes are visible. Create this class (passing your IndexWriter), and then pass this class to ControlledRealTimeReopenThread. Be sure to make all changes via the TrackingIndexWriter, otherwise ControlledRealTimeReopenThread won't know about the changes.

WARNING: This API is experimental and might change in incompatible ways in the next release.

Constructor Summary
TrackingIndexWriter(IndexWriter writer)
          Create a TrackingIndexWriter wrapping the provided IndexWriter.
 
Method Summary
 long addDocument(Iterable<? extends IndexableField> d)
          Calls IndexWriter.addDocument(Iterable) and returns the generation that reflects this change.
 long addDocument(Iterable<? extends IndexableField> d, Analyzer a)
          Calls IndexWriter.addDocument(Iterable,Analyzer) and returns the generation that reflects this change.
 long addDocuments(Iterable<? extends Iterable<? extends IndexableField>> docs)
          Calls IndexWriter.addDocuments(Iterable) and returns the generation that reflects this change.
 long addDocuments(Iterable<? extends Iterable<? extends IndexableField>> docs, Analyzer a)
          Calls IndexWriter.addDocuments(Iterable,Analyzer) and returns the generation that reflects this change.
 long addIndexes(Directory... dirs)
          Calls IndexWriter.addIndexes(Directory...) and returns the generation that reflects this change.
 long addIndexes(IndexReader... readers)
          Calls IndexWriter.addIndexes(IndexReader...) and returns the generation that reflects this change.
 long deleteAll()
          Calls IndexWriter.deleteAll() and returns the generation that reflects this change.
 long deleteDocuments(Query... queries)
          Calls IndexWriter.deleteDocuments(Query...) and returns the generation that reflects this change.
 long deleteDocuments(Query q)
          Calls IndexWriter.deleteDocuments(Query) and returns the generation that reflects this change.
 long deleteDocuments(Term... terms)
          Calls IndexWriter.deleteDocuments(Term...) and returns the generation that reflects this change.
 long deleteDocuments(Term t)
          Calls IndexWriter.deleteDocuments(Term) and returns the generation that reflects this change.
 long getAndIncrementGeneration()
          Return and increment current gen.
 long getGeneration()
          Return the current generation being indexed.
 IndexWriter getIndexWriter()
          Return the wrapped IndexWriter.
 long tryDeleteDocument(IndexReader reader, int docID)
          Cals IndexWriter.tryDeleteDocument(IndexReader,int) and returns the generation that reflects this change.
 long updateDocument(Term t, Iterable<? extends IndexableField> d)
          Calls IndexWriter.updateDocument(Term,Iterable) and returns the generation that reflects this change.
 long updateDocument(Term t, Iterable<? extends IndexableField> d, Analyzer a)
          Calls IndexWriter.updateDocument(Term,Iterable,Analyzer) and returns the generation that reflects this change.
 long updateDocuments(Term t, Iterable<? extends Iterable<? extends IndexableField>> docs)
          Calls IndexWriter.updateDocuments(Term,Iterable) and returns the generation that reflects this change.
 long updateDocuments(Term t, Iterable<? extends Iterable<? extends IndexableField>> docs, Analyzer a)
          Calls IndexWriter.updateDocuments(Term,Iterable,Analyzer) and returns the generation that reflects this change.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TrackingIndexWriter

public TrackingIndexWriter(IndexWriter writer)
Create a TrackingIndexWriter wrapping the provided IndexWriter.

Method Detail

updateDocument

public long updateDocument(Term t,
                           Iterable<? extends IndexableField> d,
                           Analyzer a)
                    throws IOException
Calls IndexWriter.updateDocument(Term,Iterable,Analyzer) and returns the generation that reflects this change.

Throws:
IOException

updateDocument

public long updateDocument(Term t,
                           Iterable<? extends IndexableField> d)
                    throws IOException
Calls IndexWriter.updateDocument(Term,Iterable) and returns the generation that reflects this change.

Throws:
IOException

updateDocuments

public long updateDocuments(Term t,
                            Iterable<? extends Iterable<? extends IndexableField>> docs,
                            Analyzer a)
                     throws IOException
Calls IndexWriter.updateDocuments(Term,Iterable,Analyzer) and returns the generation that reflects this change.

Throws:
IOException

updateDocuments

public long updateDocuments(Term t,
                            Iterable<? extends Iterable<? extends IndexableField>> docs)
                     throws IOException
Calls IndexWriter.updateDocuments(Term,Iterable) and returns the generation that reflects this change.

Throws:
IOException

deleteDocuments

public long deleteDocuments(Term t)
                     throws IOException
Calls IndexWriter.deleteDocuments(Term) and returns the generation that reflects this change.

Throws:
IOException

deleteDocuments

public long deleteDocuments(Term... terms)
                     throws IOException
Calls IndexWriter.deleteDocuments(Term...) and returns the generation that reflects this change.

Throws:
IOException

deleteDocuments

public long deleteDocuments(Query q)
                     throws IOException
Calls IndexWriter.deleteDocuments(Query) and returns the generation that reflects this change.

Throws:
IOException

deleteDocuments

public long deleteDocuments(Query... queries)
                     throws IOException
Calls IndexWriter.deleteDocuments(Query...) and returns the generation that reflects this change.

Throws:
IOException

deleteAll

public long deleteAll()
               throws IOException
Calls IndexWriter.deleteAll() and returns the generation that reflects this change.

Throws:
IOException

addDocument

public long addDocument(Iterable<? extends IndexableField> d,
                        Analyzer a)
                 throws IOException
Calls IndexWriter.addDocument(Iterable,Analyzer) and returns the generation that reflects this change.

Throws:
IOException

addDocuments

public long addDocuments(Iterable<? extends Iterable<? extends IndexableField>> docs,
                         Analyzer a)
                  throws IOException
Calls IndexWriter.addDocuments(Iterable,Analyzer) and returns the generation that reflects this change.

Throws:
IOException

addDocument

public long addDocument(Iterable<? extends IndexableField> d)
                 throws IOException
Calls IndexWriter.addDocument(Iterable) and returns the generation that reflects this change.

Throws:
IOException

addDocuments

public long addDocuments(Iterable<? extends Iterable<? extends IndexableField>> docs)
                  throws IOException
Calls IndexWriter.addDocuments(Iterable) and returns the generation that reflects this change.

Throws:
IOException

addIndexes

public long addIndexes(Directory... dirs)
                throws IOException
Calls IndexWriter.addIndexes(Directory...) and returns the generation that reflects this change.

Throws:
IOException

addIndexes

public long addIndexes(IndexReader... readers)
                throws IOException
Calls IndexWriter.addIndexes(IndexReader...) and returns the generation that reflects this change.

Throws:
IOException

getGeneration

public long getGeneration()
Return the current generation being indexed.


getIndexWriter

public IndexWriter getIndexWriter()
Return the wrapped IndexWriter.


getAndIncrementGeneration

public long getAndIncrementGeneration()
Return and increment current gen.

NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.

tryDeleteDocument

public long tryDeleteDocument(IndexReader reader,
                              int docID)
                       throws IOException
Cals IndexWriter.tryDeleteDocument(IndexReader,int) and returns the generation that reflects this change.

Throws:
IOException


Copyright © 2000-2014 Apache Software Foundation. All Rights Reserved.