FileDocCategorySizeDatePackage
GDataIndexDocument.javaAPI DocApache Lucene 2.1.04756Wed Feb 14 10:46:06 GMT 2007org.apache.lucene.gdata.search.index

GDataIndexDocument

public class GDataIndexDocument extends Object implements IndexDocument
Simple implementation
author
Simon Willnauer
see
org.apache.lucene.gdata.search.index.IndexDocument

Fields Summary
private final IndexAction
action
private final boolean
commitAfter
private final boolean
optimizeAfter
private String
id
protected Collection
fields
private final String
feedId
Constructors Summary
GDataIndexDocument(IndexAction action, String entryId, String feedId, boolean commitAfter, boolean optimizeAfter)

        this.action = action;
        this.id = entryId;
        this.feedId = feedId;
        this.fields = new ArrayList<ContentStrategy>(10);
        this.commitAfter = commitAfter;
        this.optimizeAfter = optimizeAfter;
    
Methods Summary
public voidaddField(org.apache.lucene.gdata.search.analysis.ContentStrategy field)
Adds a new field e.g. ContentStrategy to the IndexDocument

param
field - the strategy to add

        if (field == null)
            return;
        this.fields.add(field);
    
public booleancommitAfter()

see
org.apache.lucene.gdata.search.index.IndexDocument#commitAfter()


        return this.commitAfter;
    
public final booleanequals(java.lang.Object obj)

see
java.lang.Object#equals(java.lang.Object)

        if(obj == null)
            return false;
        if(this == obj)
            return true;
        if(obj instanceof GDataIndexDocument){
            GDataIndexDocument other = (GDataIndexDocument)obj; 
            if(this.id == null)
                return false;
            return this.id.equals(other.id);
        }
        return false; 
    
public org.apache.lucene.index.TermgetDeletealbe()

see
org.apache.lucene.gdata.search.index.IndexDocument#getDeletealbe()


        return new Term(IndexDocument.FIELD_ENTRY_ID, this.id);
    
public org.apache.lucene.document.DocumentgetWriteable()

see
org.apache.lucene.gdata.search.index.IndexDocument#getWriteable()

        Document retVal = new Document();
        retVal.add(new Field(FIELD_ENTRY_ID, this.id, Field.Store.YES,
                Field.Index.UN_TOKENIZED));
        retVal.add(new Field(FIELD_FEED_ID, this.feedId, Field.Store.YES,
                Field.Index.UN_TOKENIZED));
        for (ContentStrategy strategy : this.fields) {
            Field[] fieldArray = strategy.createLuceneField();
            for (int i = 0; i < fieldArray.length; i++) {
                retVal.add(fieldArray[i]);
            }
            
        }
        return retVal;
    
public final inthashCode()

see
java.lang.Object#hashCode()

        if(this.id == null)
            return super.hashCode();
        return this.id.hashCode();
    
private booleanisAction(IndexAction indexAction)

        return this.action == indexAction;
    
public booleanisDelete()

see
org.apache.lucene.gdata.search.index.IndexDocument#isDelete()


        return isAction(IndexAction.DELETE);
    
public booleanisInsert()

see
org.apache.lucene.gdata.search.index.IndexDocument#isInsert()


        return isAction(IndexAction.INSERT);
    
public booleanisUpdate()

see
org.apache.lucene.gdata.search.index.IndexDocument#isUpdate()


        return isAction(IndexAction.UPDATE);
    
public booleanoptimizeAfter()

see
org.apache.lucene.gdata.search.index.IndexDocument#optimizeAfter()


        return this.optimizeAfter;