org.apache.solr.handler.dataimport
Class CachedSqlEntityProcessor

java.lang.Object
  extended by org.apache.solr.handler.dataimport.EntityProcessor
      extended by org.apache.solr.handler.dataimport.EntityProcessorBase
          extended by org.apache.solr.handler.dataimport.SqlEntityProcessor
              extended by org.apache.solr.handler.dataimport.CachedSqlEntityProcessor

public class CachedSqlEntityProcessor
extends SqlEntityProcessor

This class enables caching of data obtained from the DB to avoid too many sql queries

Refer to http://wiki.apache.org/solr/DataImportHandler for more details.

This API is experimental and subject to change

Since:
solr 1.3
Version:
$Id: CachedSqlEntityProcessor.java 1065312 2011-01-30 16:08:25Z rmuir $

Field Summary
 
Fields inherited from class org.apache.solr.handler.dataimport.SqlEntityProcessor
dataSource, DEL_PK_QUERY, DELTA_IMPORT_QUERY, DELTA_QUERY, DOT_PATTERN, PARENT_DELTA_QUERY, QUERY
 
Fields inherited from class org.apache.solr.handler.dataimport.EntityProcessorBase
ABORT, CACHE_KEY, CACHE_LOOKUP, cachePk, cacheVariableName, cacheWithWhereClause, context, CONTINUE, dataSourceRowCache, entityName, isFirstInit, ON_ERROR, onError, query, rowIterator, simpleCache, SKIP, SKIP_DOC, TRANSFORM_ROW, TRANSFORMER, transformers
 
Constructor Summary
CachedSqlEntityProcessor()
           
 
Method Summary
protected  List<Map<String,Object>> getAllNonCachedRows()
           Get all the rows from the the datasource for the given query.
 void init(Context context)
          This method is called when it starts processing an entity.
 Map<String,Object> nextRow()
          For a simple implementation, this is the only method that the sub-class should implement.
 
Methods inherited from class org.apache.solr.handler.dataimport.SqlEntityProcessor
getDeltaImportQuery, getQuery, initQuery, nextDeletedRowKey, nextModifiedParentRowKey, nextModifiedRowKey
 
Methods inherited from class org.apache.solr.handler.dataimport.EntityProcessorBase
cacheInit, destroy, firstInit, getFromRowCacheTransformed, getIdCacheData, getNext, getSimpleCacheData
 
Methods inherited from class org.apache.solr.handler.dataimport.EntityProcessor
close, postTransform
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CachedSqlEntityProcessor

public CachedSqlEntityProcessor()
Method Detail

init

public void init(Context context)
Description copied from class: EntityProcessor
This method is called when it starts processing an entity. When it comes back to the entity it is called again. So it can reset anything at that point. For a rootmost entity this is called only once for an ingestion. For sub-entities , this is called multiple once for each row from its parent entity

Overrides:
init in class SqlEntityProcessor
Parameters:
context - The current context

nextRow

public Map<String,Object> nextRow()
Description copied from class: EntityProcessorBase
For a simple implementation, this is the only method that the sub-class should implement. This is intended to stream rows one-by-one. Return null to signal end of rows

Overrides:
nextRow in class SqlEntityProcessor
Returns:
a row where the key is the name of the field and value can be any Object or a Collection of objects. Return null to signal end of rows

getAllNonCachedRows

protected List<Map<String,Object>> getAllNonCachedRows()
Description copied from class: EntityProcessorBase

Get all the rows from the the datasource for the given query. Only used by cache implementations.

This must be implemented by sub-classes which intend to provide a cached implementation

Overrides:
getAllNonCachedRows in class EntityProcessorBase
Returns:
the list of all rows fetched from the datasource.


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