public class DataSourceIndex extends Object implements Index, IngestService, QueryService
Modifier and Type | Field and Description |
---|---|
protected DataSource |
dataSource |
protected boolean |
useUTF8 |
Constructor and Description |
---|
DataSourceIndex(String user,
String pass,
String driver,
String jdbcUrl,
boolean useUTF8) |
Modifier and Type | Method and Description |
---|---|
boolean |
delete(TransactionId<?> transactionId)
Deletes all TermBuckets attached to given TransactionId -- there should be no trace of
given transaction after this method is called.
|
Map<TransactionId<?>,List<TermBucket>> |
getBuckets(List<TransactionId<?>> transactionIds)
Does the same as getBuckets(TransactionId), except is performed over a list
of TransactionIds
|
List<TermBucket> |
getBuckets(TransactionId<?> transactionId)
Returns a List of TermBuckets ingested for a given TransactionId
|
protected int |
getNumOfTransactions() |
List<TransactionId<?>> |
getPage(IndexPager indexPage)
Returns a list of TransactionIds associated with the
given Index page.
|
IndexPager |
getPager(PageInfo pageInfo) |
Properties |
getProperties() |
String |
getProperty(String key) |
TransactionIdFactory |
getTransactionIdFactory() |
boolean |
hasTransactionId(TransactionId<?> transactionId) |
IngestReceipt |
ingest(List<TermBucket> termBuckets)
Indexes the given TermBucket to a TransactionId, and returns a IngestReceipt
|
List<IngestReceipt> |
query(QueryExpression queryExpression)
Returns all the TransactionIds that fall under the given query
|
List<IngestReceipt> |
query(QueryExpression queryExpression,
int startIndex,
int endIndex)
Returns the results of the given query such that: [startIndex, endIndex)
|
boolean |
reduce(TransactionId<?> transactionId,
List<TermBucket> termBuckets)
Deletes only the Terms in the given TermBuckets from the given TransactionId
|
int |
sizeOf(QueryExpression queryExpression)
Returns the number of results found for the given query
|
IngestReceipt |
update(TransactionId<?> transactionId,
List<TermBucket> termBuckets)
TermBucket updates to given TransactionId.
|
protected DataSource dataSource
protected boolean useUTF8
public IndexPager getPager(PageInfo pageInfo) throws CatalogIndexException
CatalogIndexException
protected int getNumOfTransactions() throws CatalogIndexException
CatalogIndexException
public List<TransactionId<?>> getPage(IndexPager indexPage) throws CatalogIndexException
getPage
in interface Index
indexPage
- The page for which TransactionIds will be returnedCatalogIndexException
public Properties getProperties() throws CatalogIndexException
getProperties
in interface Index
CatalogIndexException
public String getProperty(String key) throws CatalogIndexException
getProperty
in interface Index
CatalogIndexException
public TransactionIdFactory getTransactionIdFactory() throws CatalogIndexException
getTransactionIdFactory
in interface Index
CatalogIndexException
public boolean hasTransactionId(TransactionId<?> transactionId) throws CatalogIndexException
hasTransactionId
in interface Index
CatalogIndexException
public boolean delete(TransactionId<?> transactionId) throws IngestServiceException
delete
in interface IngestService
transactionId
- The ID for given transaction which should be erasedIngestServiceException
- Any errorpublic IngestReceipt ingest(List<TermBucket> termBuckets) throws IngestServiceException
ingest
in interface IngestService
termBuckets
- The List of TermBucket to be ingestedIngestServiceException
- Any errorpublic boolean reduce(TransactionId<?> transactionId, List<TermBucket> termBuckets) throws IngestServiceException
reduce
in interface IngestService
transactionId
- The TransactionId for which Terms will be deletedtermBuckets
- The reduction set of Terms for each TermBucketIngestServiceException
- Any errorpublic IngestReceipt update(TransactionId<?> transactionId, List<TermBucket> termBuckets) throws IngestServiceException
update
in interface IngestService
IngestServiceException
public List<TermBucket> getBuckets(TransactionId<?> transactionId) throws QueryServiceException
getBuckets
in interface QueryService
transactionId
- The TransactionId in questionQueryServiceException
public Map<TransactionId<?>,List<TermBucket>> getBuckets(List<TransactionId<?>> transactionIds) throws QueryServiceException
getBuckets
in interface QueryService
transactionIds
- A List of TransactionIds for which TermBuckets are wantedQueryServiceException
public List<IngestReceipt> query(QueryExpression queryExpression) throws QueryServiceException
query
in interface QueryService
QueryServiceException
public List<IngestReceipt> query(QueryExpression queryExpression, int startIndex, int endIndex) throws QueryServiceException
QueryService
query
in interface QueryService
queryExpression
- The query for which results will be returnedstartIndex
- The start index of subset of results to be returnedendIndex
- The end index of the subset of results to be returnedQueryServiceException
- on an errorpublic int sizeOf(QueryExpression queryExpression) throws QueryServiceException
QueryService
sizeOf
in interface QueryService
queryExpression
- The query whose size in questionQueryServiceException
- on an errorCopyright © 1999-2014 Apache OODT. All Rights Reserved.