public class SolrStore<K,T extends PersistentBase> extends DataStoreBase<K,T>
| Modifier and Type | Field and Description |
|---|---|
protected static int |
DEFAULT_BATCH_SIZE |
protected static int |
DEFAULT_COMMIT_WITHIN |
protected static String |
DEFAULT_MAPPING_FILE |
protected static int |
DEFAULT_RESULTS_SIZE |
static int |
DEFAULT_UNION_SCHEMA
Default schema index with value "0" used when AVRO Union data types are
stored
|
static ConcurrentHashMap<String,org.apache.avro.specific.SpecificDatumReader<?>> |
readerMap |
protected static String |
SOLR_BATCH_SIZE_PROPERTY |
protected static String |
SOLR_COMMIT_WITHIN_PROPERTY |
protected static String |
SOLR_CONFIG_PROPERTY |
protected static String |
SOLR_RESULTS_SIZE_PROPERTY |
protected static String |
SOLR_SCHEMA_PROPERTY |
protected static String |
SOLR_URL_PROPERTY |
static ConcurrentHashMap<String,org.apache.avro.specific.SpecificDatumWriter<?>> |
writerMap |
autoCreateSchema, beanFactory, conf, datumReader, datumWriter, fieldMap, keyClass, persistentClass, properties, schema| Constructor and Description |
|---|
SolrStore() |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close the DataStore.
|
void |
createSchema()
Creates the optional schema or table (or similar) in the datastore
to hold the objects.
|
boolean |
delete(K key)
Deletes the object with the given key
|
long |
deleteByQuery(Query<K,T> query)
Deletes all the objects matching the query.
|
void |
deleteSchema()
Deletes the underlying schema or table (or similar) in the datastore
that holds the objects.
|
static String |
escapeQueryKey(String key) |
Result<K,T> |
execute(Query<K,T> query)
Executes the given query and returns the results.
|
void |
flush()
Forces the write caches to be flushed.
|
T |
get(K key,
String[] fields)
Returns the object corresponding to the given key.
|
SolrMapping |
getMapping() |
List<PartitionQuery<K,T>> |
getPartitions(Query<K,T> query)
Partitions the given query and returns a list of
PartitionQuerys,
which will execute on local data. |
String |
getSchemaName()
Returns the schema name given to this DataStore
|
void |
initialize(Class<K> keyClass,
Class<T> persistentClass,
Properties properties)
Initializes this DataStore.
|
T |
newInstance(org.apache.solr.common.SolrDocument doc,
String[] fields) |
Query<K,T> |
newQuery()
Constructs and returns a new Query.
|
void |
put(K key,
T persistent)
Inserts the persistent object with the given key.
|
boolean |
schemaExists()
Returns whether the schema that holds the data exists in the datastore.
|
void |
truncateSchema()
Deletes all the data associated with the schema, but keeps the
schema (table or similar) intact.
|
equals, get, getBeanFactory, getConf, getFields, getFieldsToQuery, getKeyClass, getOrCreateConf, getPersistentClass, getSchemaName, newKey, newPersistent, readFields, setBeanFactory, setConf, setKeyClass, setPersistentClass, writeprotected static final String DEFAULT_MAPPING_FILE
protected static final String SOLR_URL_PROPERTY
protected static final String SOLR_CONFIG_PROPERTY
protected static final String SOLR_SCHEMA_PROPERTY
protected static final String SOLR_BATCH_SIZE_PROPERTY
protected static final String SOLR_COMMIT_WITHIN_PROPERTY
protected static final String SOLR_RESULTS_SIZE_PROPERTY
protected static final int DEFAULT_BATCH_SIZE
protected static final int DEFAULT_COMMIT_WITHIN
protected static final int DEFAULT_RESULTS_SIZE
public static int DEFAULT_UNION_SCHEMA
public static final ConcurrentHashMap<String,org.apache.avro.specific.SpecificDatumReader<?>> readerMap
public static final ConcurrentHashMap<String,org.apache.avro.specific.SpecificDatumWriter<?>> writerMap
public void initialize(Class<K> keyClass, Class<T> persistentClass, Properties properties)
DataStoreinitialize in interface DataStore<K,T extends PersistentBase>initialize in class DataStoreBase<K,T extends PersistentBase>keyClass - the class of the keyspersistentClass - the class of the persistent objectsproperties - extra metadatapublic SolrMapping getMapping()
public String getSchemaName()
DataStorepublic void createSchema()
DataStorepublic void truncateSchema()
DataStoretruncateSchema in interface DataStore<K,T extends PersistentBase>truncateSchema in class DataStoreBase<K,T extends PersistentBase>public void deleteSchema()
DataStorepublic boolean schemaExists()
DataStorepublic T get(K key, String[] fields)
DataStorekey - the key of the objectfields - the fields required in the object. Pass null, to retrieve all fieldspublic T newInstance(org.apache.solr.common.SolrDocument doc, String[] fields) throws IOException
IOExceptionpublic void put(K key, T persistent)
DataStorepublic boolean delete(K key)
DataStorekey - the key of the objectpublic long deleteByQuery(Query<K,T> query)
DataStorequery - matching records to this query will be deletedpublic Result<K,T> execute(Query<K,T> query)
DataStorequery - the query to execute.Result object.public Query<K,T> newQuery()
DataStorepublic List<PartitionQuery<K,T>> getPartitions(Query<K,T> query) throws IOException
DataStorePartitionQuerys,
which will execute on local data.query - the base query to create the partitions for. If the query
is null, then the data store returns the partitions for the default query
(returning every object)IOExceptionpublic void flush()
DataStorepublic void close()
DataStoreCopyright © 2010-2014 The Apache Software Foundation. All Rights Reserved.