org.apache.hadoop.contrib.index.mapred
Class DocumentAndOp

java.lang.Object
  extended by org.apache.hadoop.contrib.index.mapred.DocumentAndOp
All Implemented Interfaces:
org.apache.hadoop.io.Writable

public class DocumentAndOp
extends Object
implements org.apache.hadoop.io.Writable

This class represents an indexing operation. The operation can be an insert, a delete or an update. If the operation is an insert or an update, a (new) document must be specified. If the operation is a delete or an update, a delete term must be specified.


Nested Class Summary
static class DocumentAndOp.Op
          This class represents the type of an operation - an insert, a delete or an update.
 
Constructor Summary
DocumentAndOp()
          Constructor for no operation.
DocumentAndOp(DocumentAndOp.Op op, org.apache.lucene.document.Document doc)
          Constructor for an insert operation.
DocumentAndOp(DocumentAndOp.Op op, org.apache.lucene.document.Document doc, org.apache.lucene.index.Term term)
          Constructor for an insert, a delete or an update operation.
DocumentAndOp(DocumentAndOp.Op op, org.apache.lucene.index.Term term)
          Constructor for a delete operation.
 
Method Summary
 org.apache.lucene.document.Document getDocument()
          Get the document.
 DocumentAndOp.Op getOp()
          Get the type of operation.
 org.apache.lucene.index.Term getTerm()
          Get the term.
 void readFields(DataInput in)
           
 void setDelete(org.apache.lucene.index.Term term)
          Set the instance to be a delete operation.
 void setInsert(org.apache.lucene.document.Document doc)
          Set the instance to be an insert operation.
 void setUpdate(org.apache.lucene.document.Document doc, org.apache.lucene.index.Term term)
          Set the instance to be an update operation.
 String toString()
           
 void write(DataOutput out)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DocumentAndOp

public DocumentAndOp()
Constructor for no operation.


DocumentAndOp

public DocumentAndOp(DocumentAndOp.Op op,
                     org.apache.lucene.document.Document doc)
Constructor for an insert operation.

Parameters:
op -
doc -

DocumentAndOp

public DocumentAndOp(DocumentAndOp.Op op,
                     org.apache.lucene.index.Term term)
Constructor for a delete operation.

Parameters:
op -
term -

DocumentAndOp

public DocumentAndOp(DocumentAndOp.Op op,
                     org.apache.lucene.document.Document doc,
                     org.apache.lucene.index.Term term)
Constructor for an insert, a delete or an update operation.

Parameters:
op -
doc -
term -
Method Detail

setInsert

public void setInsert(org.apache.lucene.document.Document doc)
Set the instance to be an insert operation.

Parameters:
doc -

setDelete

public void setDelete(org.apache.lucene.index.Term term)
Set the instance to be a delete operation.

Parameters:
term -

setUpdate

public void setUpdate(org.apache.lucene.document.Document doc,
                      org.apache.lucene.index.Term term)
Set the instance to be an update operation.

Parameters:
doc -
term -

getOp

public DocumentAndOp.Op getOp()
Get the type of operation.

Returns:
the type of the operation.

getDocument

public org.apache.lucene.document.Document getDocument()
Get the document.

Returns:
the document

getTerm

public org.apache.lucene.index.Term getTerm()
Get the term.

Returns:
the term

toString

public String toString()
Overrides:
toString in class Object

write

public void write(DataOutput out)
           throws IOException
Specified by:
write in interface org.apache.hadoop.io.Writable
Throws:
IOException

readFields

public void readFields(DataInput in)
                throws IOException
Specified by:
readFields in interface org.apache.hadoop.io.Writable
Throws:
IOException


Copyright © 2009 The Apache Software Foundation