net.conquiris.api.index
Interface DocumentWriter

All Known Subinterfaces:
Writer

public interface DocumentWriter

Conquiris document writing interface. Implementations MUST BE thread-safe. All methods throw IllegalStateException if the writer can no longer be used, InterruptedException if the thread they are running is interrupted and IndexException if there's a problem with the index.

Author:
Andres Rodriguez

Method Summary
 DocumentWriter add(Document document)
          Adds a document.
 DocumentWriter add(Document document, Analyzer analyzer)
          Adds a document.
 void cancel()
          Cancels the operation of this writer.
 DocumentWriter delete(String field, String text)
          Deletes documents matching a certain term.
 DocumentWriter delete(Term term)
          Deletes documents matching a certain term.
 DocumentWriter deleteAll()
          Deletes all documents.
 DocumentWriter update(String field, String text, Document document)
          Atomically (with respect to index flushing) deletes the documents matching a certain term and adds a document.
 DocumentWriter update(String field, String text, Document document, Analyzer analyzer)
          Atomically (with respect to index flushing) deletes the documents matching a certain term and adds a document.
 DocumentWriter update(Term term, Document document)
          Atomically (with respect to index flushing) deletes the documents matching a certain term and adds a document.
 DocumentWriter update(Term term, Document document, Analyzer analyzer)
          Atomically (with respect to index flushing) deletes the documents matching a certain term and adds a document.
 

Method Detail

cancel

void cancel()
            throws InterruptedException
Cancels the operation of this writer. Indexer can continue but all operations from all children and sibling subwriters will be ignored and the index writer will be rolled back.

Throws:
InterruptedException

add

DocumentWriter add(@Nullable
                   Document document)
                   throws InterruptedException,
                          IndexException
Adds a document. The service default analyzer will be used.

Parameters:
document - Document to add. If null the method is a no-op.
Returns:
This writer for method chaining.
Throws:
InterruptedException
IndexException

add

DocumentWriter add(@Nullable
                   Document document,
                   @Nullable
                   Analyzer analyzer)
                   throws InterruptedException,
                          IndexException
Adds a document.

Parameters:
document - Document to add. If null the method is a no-op.
analyzer - Analyzer to use. If null the service default analyzer will be used.
Returns:
This writer for method chaining.
Throws:
InterruptedException
IndexException

deleteAll

DocumentWriter deleteAll()
                         throws InterruptedException,
                                IndexException
Deletes all documents.

Returns:
This writer for method chaining.
Throws:
InterruptedException
IndexException

delete

DocumentWriter delete(@Nullable
                      String field,
                      @Nullable
                      String text)
                      throws InterruptedException,
                             IndexException
Deletes documents matching a certain term.

Parameters:
field - Field to match. If null the method is a no-op.
text - Term text to match. If null the method is a no-op.
Returns:
This writer for method chaining.
Throws:
InterruptedException
IndexException

delete

DocumentWriter delete(@Nullable
                      Term term)
                      throws InterruptedException,
                             IndexException
Deletes documents matching a certain term.

Parameters:
term - Term to match. If null the method is a no-op.
Returns:
This writer for method chaining.
Throws:
InterruptedException
IndexException

update

DocumentWriter update(@Nullable
                      String field,
                      @Nullable
                      String text,
                      @Nullable
                      Document document)
                      throws InterruptedException,
                             IndexException
Atomically (with respect to index flushing) deletes the documents matching a certain term and adds a document.

Parameters:
field - Field to match. If null no deletion will be performed.
text - Term text to match. If null no deletion will be performed.
document - Document to add. If null no document will be added.
Returns:
This writer for method chaining.
Throws:
InterruptedException
IndexException

update

DocumentWriter update(@Nullable
                      Term term,
                      @Nullable
                      Document document)
                      throws InterruptedException,
                             IndexException
Atomically (with respect to index flushing) deletes the documents matching a certain term and adds a document.

Parameters:
term - Term to match. If null no deletion will be performed.
document - Document to add. If null no document will be added.
Returns:
This writer for method chaining.
Throws:
InterruptedException
IndexException

update

DocumentWriter update(@Nullable
                      String field,
                      @Nullable
                      String text,
                      @Nullable
                      Document document,
                      @Nullable
                      Analyzer analyzer)
                      throws InterruptedException,
                             IndexException
Atomically (with respect to index flushing) deletes the documents matching a certain term and adds a document.

Parameters:
field - Field to match. If null no deletion will be performed.
text - Term text to match. If null no deletion will be performed.
document - Document to add. If null no document will be added.
analyzer - Analyzer to use. If null the service default analyzer will be used.
Returns:
This writer for method chaining.
Throws:
InterruptedException
IndexException

update

DocumentWriter update(@Nullable
                      Term term,
                      @Nullable
                      Document document,
                      @Nullable
                      Analyzer analyzer)
                      throws InterruptedException,
                             IndexException
Atomically (with respect to index flushing) deletes the documents matching a certain term and adds a document.

Parameters:
term - Term to match. If null no deletion will be performed.
document - Document to add. If null no document will be added.
analyzer - Analyzer to use. If null the service default analyzer will be used.
Returns:
This writer for method chaining.
Throws:
InterruptedException
IndexException


Copyright © 2013 Derquinse Projects. All Rights Reserved.