anl.aida.ae.lucene
Class DefaultFieldBuilder

java.lang.Object
  extended by anl.aida.ae.lucene.DefaultFieldBuilder
All Implemented Interfaces:
FieldBuilder

public class DefaultFieldBuilder
extends java.lang.Object
implements FieldBuilder

Default implementation of a FieldBuilder.


Field Summary
private  float boost
           
private  java.util.List<org.apache.uima.cas.Feature> features
           
private  java.lang.String fieldName
           
private  java.lang.String keywordType
           
private  org.apache.uima.cas.Type type
           
 
Constructor Summary
DefaultFieldBuilder(java.lang.String fieldName, org.apache.uima.cas.Type type, org.apache.uima.cas.Feature feature)
          Constructs a DefaultFieldBuilder.
DefaultFieldBuilder(java.lang.String fieldName, org.apache.uima.cas.Type type, org.apache.uima.cas.Feature feature, float boost)
          Constructs a DefaultFieldBuilder.
 
Method Summary
 void addFeature(org.apache.uima.cas.Feature feature)
          Adds a feature.
 org.apache.lucene.document.Field build(org.apache.uima.cas.CAS cas, org.apache.lucene.document.Document doc, Keywords keywords)
          Builds a Field in the specified Document using values from the specified CAS.
 java.lang.String getFieldName()
          Gets the name of the field this builder will create.
 java.lang.String getKeywordType()
          If this field holds keywords, then this gets the keyword type (e.g.
(package private)  boolean isValid()
           
 void setKeywordType(java.lang.String type)
          Sets the keyword type for this field builder.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fieldName

private java.lang.String fieldName

features

private java.util.List<org.apache.uima.cas.Feature> features

type

private org.apache.uima.cas.Type type

boost

private float boost

keywordType

private java.lang.String keywordType
Constructor Detail

DefaultFieldBuilder

public DefaultFieldBuilder(java.lang.String fieldName,
                           org.apache.uima.cas.Type type,
                           org.apache.uima.cas.Feature feature)
Constructs a DefaultFieldBuilder.

Parameters:
fieldName - the name of the field to build
type - the annotation type that contains the features that become the content of the field
feature - the feature whose values become the content of the field

DefaultFieldBuilder

public DefaultFieldBuilder(java.lang.String fieldName,
                           org.apache.uima.cas.Type type,
                           org.apache.uima.cas.Feature feature,
                           float boost)
Constructs a DefaultFieldBuilder.

Parameters:
fieldName - the name of the field to build
type - the annotation type that contains the features that become the content of the field
feature - the feature whose values become the content of the field
boost - the lucene boost value for the created field
Method Detail

getKeywordType

public java.lang.String getKeywordType()
If this field holds keywords, then this gets the keyword type (e.g. "BioAgent"), otherwise this returns null.

Specified by:
getKeywordType in interface FieldBuilder
Returns:
the keyword type, if applicable, otherwise null.

setKeywordType

public void setKeywordType(java.lang.String type)
Sets the keyword type for this field builder.

Parameters:
type - the keyword type

getFieldName

public java.lang.String getFieldName()
Description copied from interface: FieldBuilder
Gets the name of the field this builder will create.

Specified by:
getFieldName in interface FieldBuilder
Returns:
the name of the field this builder will create.

addFeature

public void addFeature(org.apache.uima.cas.Feature feature)
Adds a feature. The values of the added feature will be added to the field's contents.

Parameters:
feature - the feature to add

isValid

boolean isValid()

build

public org.apache.lucene.document.Field build(org.apache.uima.cas.CAS cas,
                                              org.apache.lucene.document.Document doc,
                                              Keywords keywords)
                                       throws AIDAException
Builds a Field in the specified Document using values from the specified CAS.

Specified by:
build in interface FieldBuilder
Parameters:
cas - the CAS to use to build the field
doc - the doc to add the fields to
Throws:
AIDAException