public class MongoPublisherStore extends Object implements PublisherStore<DNetOAIMongoCursor>
| Constructor and Description |
|---|
MongoPublisherStore() |
MongoPublisherStore(String id,
String metadataFormat,
String interpretation,
String layout,
com.mongodb.client.MongoCollection<com.mongodb.DBObject> collection,
List<eu.dnetlib.data.information.oai.publisher.PublisherField> mongoFields,
RecordInfoGenerator recordInfoGenerator,
String idScheme,
String idNamespace,
MetadataExtractor metadataExtractor,
RecordChangeDetector recordChangeDetector,
boolean alwaysNewRecord,
com.mongodb.client.MongoDatabase mongodb) |
| Modifier and Type | Method and Description |
|---|---|
int |
count()
Counts the number of records in this store.
|
int |
count(String queryString)
Counts the number of records in this store matching the query.
|
void |
createCompoundIndex(List<String> fieldNames)
Creates a compound index over the specified fields on the given store.
|
org.bson.types.Binary |
createCompressRecord(String record) |
void |
drop()
Drops the content of the store.
|
void |
drop(String queryString)
Drops the elements matching the query from the store.
|
void |
ensureIndices()
Ensure indices on the configuration-defined fields and on the system fields DATESTAMP_FIELD and LAST_COLLECTION_DATE_FIELD.
|
boolean |
equals(Object obj) |
int |
feed(Iterable<String> records,
String source)
Feeds the store with the given records.
|
com.mongodb.client.MongoCollection<com.mongodb.DBObject> |
getCollection() |
com.mongodb.client.MongoCollection<com.mongodb.DBObject> |
getDiscardedCollection() |
List<String> |
getDistinctSetNamesFromRecords() |
String |
getId()
Returns the identifier of this store.
|
String |
getIdNamespace() |
String |
getIdScheme() |
List<eu.dnetlib.data.information.oai.publisher.PublisherField> |
getIndices()
Gets informaton about the indices available on this store.
|
String |
getInterpretation()
Gets the interpretation of this store.
|
String |
getLayout()
Gets the layout of this store.
|
MetadataExtractor |
getMetadataExtractor() |
String |
getMetadataFormat()
Gets the metadata format of this store.
|
List<eu.dnetlib.data.information.oai.publisher.PublisherField> |
getMongoFields() |
MongoSetCollection |
getMongoSetCollection() |
eu.dnetlib.data.information.oai.publisher.info.RecordInfo |
getRecord(String recordId)
Retrieves the record with the given identifier from this store.
|
eu.dnetlib.data.information.oai.publisher.info.RecordInfo |
getRecord(String recordId,
eu.dnetlib.miscutils.functional.UnaryFunction<String,String> unaryFunction)
Retrieves the record with the given identifier from this store and apply the given unary function before delivering.
|
RecordChangeDetector |
getRecordChangeDetector() |
RecordInfoGenerator |
getRecordInfoGenerator() |
DNetOAIMongoCursor |
getRecords(String queryString,
boolean bodyIncluded,
int limit)
Retrieves the records matching the given query string.
|
DNetOAIMongoCursor |
getRecords(String queryString,
eu.dnetlib.miscutils.functional.UnaryFunction<String,String> unaryFunction,
boolean bodyIncluded,
int limit)
Retrieves the records matching the given query string and apply the given unary function before delivering.
|
int |
hashCode() |
boolean |
isAlwaysNewRecord() |
void |
setAlwaysNewRecord(boolean alwaysNewRecord) |
void |
setCollection(com.mongodb.client.MongoCollection<com.mongodb.DBObject> collection) |
void |
setDiscardedCollection(com.mongodb.client.MongoCollection<com.mongodb.DBObject> discardedCollection) |
void |
setId(String id) |
void |
setIdNamespace(String idNamespace) |
void |
setIdScheme(String idScheme) |
void |
setInterpretation(String interpretation) |
void |
setLayout(String layout) |
void |
setMetadataExtractor(MetadataExtractor metadataExtractor) |
void |
setMetadataFormat(String metadataFormat) |
void |
setMongoFields(List<eu.dnetlib.data.information.oai.publisher.PublisherField> mongoFields) |
void |
setMongoSetCollection(MongoSetCollection mongoSetCollection) |
void |
setRecordChangeDetector(RecordChangeDetector recordChangeDetector) |
void |
setRecordInfoGenerator(RecordInfoGenerator recordInfoGenerator) |
String |
toString() |
void |
upsertSets(Iterable<String> setNames) |
public MongoPublisherStore()
public MongoPublisherStore(String id, String metadataFormat, String interpretation, String layout, com.mongodb.client.MongoCollection<com.mongodb.DBObject> collection, List<eu.dnetlib.data.information.oai.publisher.PublisherField> mongoFields, RecordInfoGenerator recordInfoGenerator, String idScheme, String idNamespace, MetadataExtractor metadataExtractor, RecordChangeDetector recordChangeDetector, boolean alwaysNewRecord, com.mongodb.client.MongoDatabase mongodb)
public eu.dnetlib.data.information.oai.publisher.info.RecordInfo getRecord(String recordId)
PublisherStoregetRecord in interface PublisherStore<DNetOAIMongoCursor>recordId - identifier of the record to retrievepublic eu.dnetlib.data.information.oai.publisher.info.RecordInfo getRecord(String recordId, eu.dnetlib.miscutils.functional.UnaryFunction<String,String> unaryFunction)
PublisherStoregetRecord in interface PublisherStore<DNetOAIMongoCursor>recordId - identifier of the record to retrieveunaryFunction - mapping from String to Stringpublic DNetOAIMongoCursor getRecords(String queryString, boolean bodyIncluded, int limit)
PublisherStoregetRecords in interface PublisherStore<DNetOAIMongoCursor>queryString - search criterionbodyIncluded - false to get only identifiers, true to also get the body of recordslimit - max number of records to return. 0 means no limit.public DNetOAIMongoCursor getRecords(String queryString, eu.dnetlib.miscutils.functional.UnaryFunction<String,String> unaryFunction, boolean bodyIncluded, int limit)
PublisherStoregetRecords in interface PublisherStore<DNetOAIMongoCursor>queryString - search criterionunaryFunction - mapping from String to StringbodyIncluded - false to get only identifiers, true to also get the body of recordslimit - max number of records to return. 0 means no limit.public List<eu.dnetlib.data.information.oai.publisher.PublisherField> getIndices()
PublisherStoregetIndices in interface PublisherStore<DNetOAIMongoCursor>public void ensureIndices()
Ensure indices on the configuration-defined fields and on the system fields DATESTAMP_FIELD and LAST_COLLECTION_DATE_FIELD.
Note that by default ID_FIELD, SET_FIELD, DELETED_FIELD, BODY_FIELD, UPDATED_FIELD are not indexed. If you want an index on those,
then you have to specify it in the configuration file of the OAI Publisher:
ensureIndices in interface PublisherStore<DNetOAIMongoCursor>public void createCompoundIndex(List<String> fieldNames)
The creation is performed on the background
fieldNames - List of fields to be included in the compound indexpublic int feed(Iterable<String> records, String source)
PublisherStorefeed in interface PublisherStore<DNetOAIMongoCursor>records - XML records to store.source - String that identifies the record source.public void drop()
PublisherStoredrop in interface PublisherStore<DNetOAIMongoCursor>public void drop(String queryString)
PublisherStoredrop in interface PublisherStore<DNetOAIMongoCursor>public int count()
PublisherStorecount in interface PublisherStore<DNetOAIMongoCursor>public int count(String queryString)
PublisherStorecount in interface PublisherStore<DNetOAIMongoCursor>queryString - querypublic org.bson.types.Binary createCompressRecord(String record) throws IOException
record - IOExceptionpublic com.mongodb.client.MongoCollection<com.mongodb.DBObject> getCollection()
public void setCollection(com.mongodb.client.MongoCollection<com.mongodb.DBObject> collection)
public com.mongodb.client.MongoCollection<com.mongodb.DBObject> getDiscardedCollection()
public void setDiscardedCollection(com.mongodb.client.MongoCollection<com.mongodb.DBObject> discardedCollection)
public String getIdScheme()
public void setIdScheme(String idScheme)
public String getIdNamespace()
public void setIdNamespace(String idNamespace)
public RecordInfoGenerator getRecordInfoGenerator()
public void setRecordInfoGenerator(RecordInfoGenerator recordInfoGenerator)
public MetadataExtractor getMetadataExtractor()
public void setMetadataExtractor(MetadataExtractor metadataExtractor)
public RecordChangeDetector getRecordChangeDetector()
public void setRecordChangeDetector(RecordChangeDetector recordChangeDetector)
public String getId()
PublisherStoregetId in interface PublisherStore<DNetOAIMongoCursor>public void setId(String id)
public String getMetadataFormat()
PublisherStoregetMetadataFormat in interface PublisherStore<DNetOAIMongoCursor>public void setMetadataFormat(String metadataFormat)
public String getInterpretation()
PublisherStoregetInterpretation in interface PublisherStore<DNetOAIMongoCursor>public void setInterpretation(String interpretation)
public String getLayout()
PublisherStoregetLayout in interface PublisherStore<DNetOAIMongoCursor>public void setLayout(String layout)
public MongoSetCollection getMongoSetCollection()
public void setMongoSetCollection(MongoSetCollection mongoSetCollection)
public List<eu.dnetlib.data.information.oai.publisher.PublisherField> getMongoFields()
public void setMongoFields(List<eu.dnetlib.data.information.oai.publisher.PublisherField> mongoFields)
public boolean isAlwaysNewRecord()
public void setAlwaysNewRecord(boolean alwaysNewRecord)
Copyright © 2026. All rights reserved.