org.apache.lucene.gdata.search.analysis
Class ContentStrategy

java.lang.Object
  extended by org.apache.lucene.gdata.search.analysis.ContentStrategy
Direct Known Subclasses:
GdataCategoryStrategy, GdataDateStrategy, HTMLStrategy, KeywordStrategy, MixedContentStrategy, PlainTextStrategy

public abstract class ContentStrategy
extends Object

Creating Indexable document requires processing of incoming entities as GData Entries. Entries in the GData protocol might have very different structures and content. They all have on thing in common as they are atom xml format. To retrieve the configured elements of the atom format and process the actual content might differ from element to element.

Each predefined ContentStrategy can be used to retrieve certain content from the defined element. Which element to process is defined using a XPath expression in the gdata-config.xml file.

ContentStrategy implementation should not be accessed directly. To get a ContentStrategy for a specific IndexSchemaField.ContentType use the getFieldStrategy(org.apache.lucene.gdata.search.config.IndexSchemaField) factory method. This method expects a IndexSchemaField instance with a set ContentType. The return value is a new ContentStrategy instance for the defined ContentType.

Author:
Simon Willnauer
See Also:
IndexSchemaField.ContentType, IndexDocumentBuilder

Field Summary
protected  IndexSchemaField config
           
protected  String content
           
protected  String fieldName
           
protected  Field.Index index
           
protected  Field.Store store
           
 
Constructor Summary
protected ContentStrategy(Field.Index index, Field.Store store, IndexSchemaField fieldConfig)
           
protected ContentStrategy(IndexSchemaField fieldConfiguration)
           
 
Method Summary
 Field[] createLuceneField()
          This method creates a lucene field from the retrieved content of the entity.
static ContentStrategy getFieldStrategy(IndexSchemaField fieldConfig)
          This factory method creates the ContentStrategy corresponding to the set ContentType value in the IndexSchemaField passed to the method as the single parameter.
abstract  void processIndexable(Indexable<? extends Node,? extends ServerBaseEntry> indexable)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

store

protected final Field.Store store

index

protected final Field.Index index

config

protected final IndexSchemaField config

content

protected String content

fieldName

protected String fieldName
Constructor Detail

ContentStrategy

protected ContentStrategy(IndexSchemaField fieldConfiguration)

ContentStrategy

protected ContentStrategy(Field.Index index,
                          Field.Store store,
                          IndexSchemaField fieldConfig)
Method Detail

processIndexable

public abstract void processIndexable(Indexable<? extends Node,? extends ServerBaseEntry> indexable)
                               throws NotIndexableException
Parameters:
indexable -
Throws:
NotIndexableException

createLuceneField

public Field[] createLuceneField()
This method creates a lucene field from the retrieved content of the entity. Values for Field.Index, Field.Store, the field name and the boost factor are configured in the IndexSchemaField passed by the constructor e.g the factory method. This method might be overwritten by subclasses.

Returns:
the Lucene Field

getFieldStrategy

public static ContentStrategy getFieldStrategy(IndexSchemaField fieldConfig)
This factory method creates the ContentStrategy corresponding to the set ContentType value in the IndexSchemaField passed to the method as the single parameter.

The ContentType must not be null

Parameters:
fieldConfig - - the field config to use to identify the corresponding ContentStrategy
Returns:
- a new ContentStrategy instance


Copyright © 2000-2008 Apache Software Foundation. All Rights Reserved.