anl.aida.ae.lucene
Class Keywords

java.lang.Object
  extended by anl.aida.ae.lucene.Keywords

public class Keywords
extends java.lang.Object

Manages keywords, keyword sets and keyword fields (a lucene field associated with a particular keyword set).


Field Summary
private  java.util.List<java.lang.String> fields
           
private  java.util.Map<java.lang.String,java.util.Set<java.lang.String>> keywordMap
           
 
Constructor Summary
Keywords()
           
 
Method Summary
 void addKeyword(java.lang.String keywordSet, java.lang.String keyword)
          Adds the specified keyword to the specified set.
 void addKeywordField(java.lang.String fieldName)
          Adds the specified field name as a keyword field.
 void clearKeywords()
          Clears this Keywords of any keywords and keyword sets.
 java.util.Set<java.lang.String> getKeywordsAsTerms()
          Gets the keywords in the their term format.
 java.lang.Iterable<java.lang.String> keywordFields()
          Gets an iterable over the lucene field names.
 void writeXML(java.io.PrintWriter out)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

keywordMap

private java.util.Map<java.lang.String,java.util.Set<java.lang.String>> keywordMap

fields

private java.util.List<java.lang.String> fields
Constructor Detail

Keywords

public Keywords()
Method Detail

addKeywordField

public void addKeywordField(java.lang.String fieldName)
Adds the specified field name as a keyword field.

Parameters:
fieldName - the name of the keyword field

keywordFields

public java.lang.Iterable<java.lang.String> keywordFields()
Gets an iterable over the lucene field names.

Returns:
an iterable over the lucene field names.

getKeywordsAsTerms

public java.util.Set<java.lang.String> getKeywordsAsTerms()
Gets the keywords in the their term format. The term format is the lower-cased canonical format.

Returns:
the keywords in the their term format.

clearKeywords

public void clearKeywords()
Clears this Keywords of any keywords and keyword sets.


addKeyword

public void addKeyword(java.lang.String keywordSet,
                       java.lang.String keyword)
Adds the specified keyword to the specified set. The keyword should be the canonical name. This is then lower cased to create a the keyword term.

Parameters:
keywordSet - the name of the keyword set
keyword - the keyword itself

writeXML

public void writeXML(java.io.PrintWriter out)