public class SolrStore<K,T extends PersistentBase> extends DataStoreBase<K,T>
Modifier and Type | Field and Description |
---|---|
protected static int |
DEFAULT_BATCH_SIZE
The default batch size (ArrayList) of SolrDocuments to be used in the event of an absent
value for
solr.batchSize . |
protected static int |
DEFAULT_COMMIT_WITHIN
The default commit size of SolrDocuments to be used in the event of an absent
value for
solr.commitSize . |
protected static String |
DEFAULT_MAPPING_FILE
The default file name value to be used for obtaining the Solr object field mapping's
|
protected static int |
DEFAULT_RESULTS_SIZE
The default results size of SolrDocuments to be used in the event of an absent
value for
solr.resultsSize . |
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
A batch size unit (ArrayList) of SolrDocument's to be used for writing to Solr.
|
protected static String |
SOLR_COMMIT_WITHIN_PROPERTY
A batch commit unit for SolrDocument's used when making (commit) calls to Solr.
|
protected static String |
SOLR_CONFIG_PROPERTY
The
solrconfig.xml file to be used - defined in gora.properties |
protected static String |
SOLR_RESULTS_SIZE_PROPERTY
The maximum number of result to return when we make a call to
execute(Query) . |
protected static String |
SOLR_SCHEMA_PROPERTY
The
schema.xml file to be used - defined in gora.properties |
protected static String |
SOLR_SOLRJSERVER_IMPL
The solrj implementation to use.
|
protected static String |
SOLR_URL_PROPERTY
The URL of the Solr server - defined in
gora.properties |
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
PartitionQuery s,
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, write
protected static final String DEFAULT_MAPPING_FILE
protected static final String SOLR_URL_PROPERTY
gora.properties
protected static final String SOLR_CONFIG_PROPERTY
solrconfig.xml
file to be used - defined in gora.properties
protected static final String SOLR_SCHEMA_PROPERTY
schema.xml
file to be used - defined in gora.properties
protected static final String SOLR_BATCH_SIZE_PROPERTY
gora.properties
.
A default value of 100 is used if this value is absent. This value must be of type Integer.protected static final String SOLR_SOLRJSERVER_IMPL
gora.properties
This value must be of type String.protected static final String SOLR_COMMIT_WITHIN_PROPERTY
gora.properties
.
A default value of 1000 is used if this value is absent. This value must be of type Integer.protected static final String SOLR_RESULTS_SIZE_PROPERTY
execute(Query)
. This should be
defined in gora.properties
. This value must be of type Integer.protected static final int DEFAULT_BATCH_SIZE
solr.batchSize
.
Set to 100 by default.protected static final int DEFAULT_COMMIT_WITHIN
solr.commitSize
.
Set to 1000 by default.protected static final int DEFAULT_RESULTS_SIZE
solr.resultsSize
.
Set to 100 by default.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)
DataStore
initialize
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()
DataStore
public void createSchema()
DataStore
public void truncateSchema()
DataStore
truncateSchema
in interface DataStore<K,T extends PersistentBase>
truncateSchema
in class DataStoreBase<K,T extends PersistentBase>
public void deleteSchema()
DataStore
public boolean schemaExists()
DataStore
public T get(K key, String[] fields)
DataStore
key
- 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
IOException
public void put(K key, T persistent)
DataStore
public boolean delete(K key)
DataStore
key
- the key of the objectpublic long deleteByQuery(Query<K,T> query)
DataStore
query
- matching records to this query will be deletedpublic Result<K,T> execute(Query<K,T> query)
DataStore
query
- the query to execute.Result
object.public Query<K,T> newQuery()
DataStore
public List<PartitionQuery<K,T>> getPartitions(Query<K,T> query) throws IOException
DataStore
PartitionQuery
s,
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)IOException
public void flush()
DataStore
public void close()
DataStore
Copyright © 2010-2014 The Apache Software Foundation. All Rights Reserved.