Package org.dspace.app.suggestion
Class SolrSuggestionStorageServiceImpl
java.lang.Object
org.dspace.app.suggestion.SolrSuggestionStorageServiceImpl
- All Implemented Interfaces:
SolrSuggestionStorageService
public class SolrSuggestionStorageServiceImpl
extends Object
implements SolrSuggestionStorageService
Service to deal with the local suggestion solr core used by the
SolrSuggestionProvider(s)
- Author:
- Andrea Bollini (andrea.bollini at 4science dot it)
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.apache.solr.client.solrj.SolrClientFields inherited from interface org.dspace.app.suggestion.SolrSuggestionStorageService
ABSTRACT, CATEGORY, CONTRIBUTORS, DATE, DISPLAY, EVIDENCES, EXTERNAL_URI, PROCESSED, SCORE, SOURCE, SUGGESTION_FULLID, SUGGESTION_ID, TARGET_ID, TITLE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddSuggestion(Suggestion suggestion, boolean force, boolean commit) Add a new suggestion to SOLRvoidcommit()Performs an explicit commit, causing pending documents to be committed for indexing.longcountAllTargets(Context context, String source) Count all the targets related to the given source.longcountUnprocessedSuggestionByTarget(Context context, String source, UUID target) Count all the unprocessed suggestions related to the given source and target.voiddeleteSuggestion(Suggestion suggestion) Delete a suggestion from SOLR if anyvoiddeleteTarget(SuggestionTarget target) Delete all the suggestions from SOLR if any related to a specific targetbooleanexist(Suggestion suggestion) Return true if the suggestion is already in SOLR and flagged as processedfindAllTargets(Context context, String source, int pageSize, long offset) Find all the suggestion targets related to the given source.findAllUnprocessedSuggestions(Context context, String source, UUID target, int pageSize, long offset, boolean ascending) Find all the unprocessed suggestions related to the given source and target.findTarget(Context context, String source, UUID target) Find a suggestion target by the given source and target.findUnprocessedSuggestion(Context context, String source, UUID target, String id) Find an unprocessed suggestion by the given source, target id and suggestion id.voidflagAllSuggestionAsProcessed(String source, String idPart) Flag all the suggestion related to the given source and id as processed.voidflagSuggestionAsProcessed(Suggestion suggestion) Flag a suggestion as processed in SOLR if anyprotected org.apache.solr.client.solrj.SolrClientgetSolr()Get solr client which use suggestion core
-
Field Details
-
solrSuggestionClient
protected org.apache.solr.client.solrj.SolrClient solrSuggestionClient
-
-
Constructor Details
-
SolrSuggestionStorageServiceImpl
public SolrSuggestionStorageServiceImpl()
-
-
Method Details
-
getSolr
protected org.apache.solr.client.solrj.SolrClient getSolr()Get solr client which use suggestion core- Returns:
- solr client
-
addSuggestion
public void addSuggestion(Suggestion suggestion, boolean force, boolean commit) throws org.apache.solr.client.solrj.SolrServerException, IOException Description copied from interface:SolrSuggestionStorageServiceAdd a new suggestion to SOLR- Specified by:
addSuggestionin interfaceSolrSuggestionStorageServiceforce- true if the suggestion must be reindexed- Throws:
org.apache.solr.client.solrj.SolrServerExceptionIOException
-
commit
Description copied from interface:SolrSuggestionStorageServicePerforms an explicit commit, causing pending documents to be committed for indexing.- Specified by:
commitin interfaceSolrSuggestionStorageService- Throws:
org.apache.solr.client.solrj.SolrServerExceptionIOException
-
exist
public boolean exist(Suggestion suggestion) throws org.apache.solr.client.solrj.SolrServerException, IOException Description copied from interface:SolrSuggestionStorageServiceReturn true if the suggestion is already in SOLR and flagged as processed- Specified by:
existin interfaceSolrSuggestionStorageService- Returns:
- true if the suggestion is already in SOLR and flagged as processed
- Throws:
org.apache.solr.client.solrj.SolrServerExceptionIOException
-
deleteSuggestion
public void deleteSuggestion(Suggestion suggestion) throws org.apache.solr.client.solrj.SolrServerException, IOException Description copied from interface:SolrSuggestionStorageServiceDelete a suggestion from SOLR if any- Specified by:
deleteSuggestionin interfaceSolrSuggestionStorageService- Throws:
org.apache.solr.client.solrj.SolrServerExceptionIOException
-
flagSuggestionAsProcessed
public void flagSuggestionAsProcessed(Suggestion suggestion) throws org.apache.solr.client.solrj.SolrServerException, IOException Description copied from interface:SolrSuggestionStorageServiceFlag a suggestion as processed in SOLR if any- Specified by:
flagSuggestionAsProcessedin interfaceSolrSuggestionStorageService- Throws:
org.apache.solr.client.solrj.SolrServerExceptionIOException
-
flagAllSuggestionAsProcessed
public void flagAllSuggestionAsProcessed(String source, String idPart) throws org.apache.solr.client.solrj.SolrServerException, IOException Description copied from interface:SolrSuggestionStorageServiceFlag all the suggestion related to the given source and id as processed.- Specified by:
flagAllSuggestionAsProcessedin interfaceSolrSuggestionStorageService- Parameters:
source- the source nameidPart- the id's last part- Throws:
org.apache.solr.client.solrj.SolrServerExceptionIOException
-
deleteTarget
public void deleteTarget(SuggestionTarget target) throws org.apache.solr.client.solrj.SolrServerException, IOException Description copied from interface:SolrSuggestionStorageServiceDelete all the suggestions from SOLR if any related to a specific target- Specified by:
deleteTargetin interfaceSolrSuggestionStorageService- Throws:
org.apache.solr.client.solrj.SolrServerExceptionIOException
-
countAllTargets
public long countAllTargets(Context context, String source) throws org.apache.solr.client.solrj.SolrServerException, IOException Description copied from interface:SolrSuggestionStorageServiceCount all the targets related to the given source.- Specified by:
countAllTargetsin interfaceSolrSuggestionStorageServicesource- the source name- Returns:
- the target's count
- Throws:
org.apache.solr.client.solrj.SolrServerExceptionIOException
-
countUnprocessedSuggestionByTarget
public long countUnprocessedSuggestionByTarget(Context context, String source, UUID target) throws org.apache.solr.client.solrj.SolrServerException, IOException Description copied from interface:SolrSuggestionStorageServiceCount all the unprocessed suggestions related to the given source and target.- Specified by:
countUnprocessedSuggestionByTargetin interfaceSolrSuggestionStorageService- Parameters:
context- the DSpace Contextsource- the source nametarget- the target id- Returns:
- the suggestion count
- Throws:
org.apache.solr.client.solrj.SolrServerExceptionIOException
-
findAllUnprocessedSuggestions
public List<Suggestion> findAllUnprocessedSuggestions(Context context, String source, UUID target, int pageSize, long offset, boolean ascending) throws org.apache.solr.client.solrj.SolrServerException, IOException Description copied from interface:SolrSuggestionStorageServiceFind all the unprocessed suggestions related to the given source and target.- Specified by:
findAllUnprocessedSuggestionsin interfaceSolrSuggestionStorageService- Parameters:
context- the DSpace Contextsource- the source nametarget- the target idpageSize- the page sizeoffset- the page offsetascending- true to retrieve the suggestions ordered by score ascending- Returns:
- the found suggestions
- Throws:
org.apache.solr.client.solrj.SolrServerExceptionIOException
-
findAllTargets
public List<SuggestionTarget> findAllTargets(Context context, String source, int pageSize, long offset) throws org.apache.solr.client.solrj.SolrServerException, IOException Description copied from interface:SolrSuggestionStorageServiceFind all the suggestion targets related to the given source.- Specified by:
findAllTargetsin interfaceSolrSuggestionStorageService- Parameters:
context- the DSpace Contextsource- the source namepageSize- the page sizeoffset- the page offset- Returns:
- the found suggestion targets
- Throws:
org.apache.solr.client.solrj.SolrServerExceptionIOException
-
findUnprocessedSuggestion
public Suggestion findUnprocessedSuggestion(Context context, String source, UUID target, String id) throws org.apache.solr.client.solrj.SolrServerException, IOException Description copied from interface:SolrSuggestionStorageServiceFind an unprocessed suggestion by the given source, target id and suggestion id.- Specified by:
findUnprocessedSuggestionin interfaceSolrSuggestionStorageService- Parameters:
context- the DSpace Contextsource- the source nametarget- the target idid- the suggestion id- Returns:
- the suggestion, if any
- Throws:
org.apache.solr.client.solrj.SolrServerExceptionIOException
-
findTarget
public SuggestionTarget findTarget(Context context, String source, UUID target) throws org.apache.solr.client.solrj.SolrServerException, IOException Description copied from interface:SolrSuggestionStorageServiceFind a suggestion target by the given source and target.- Specified by:
findTargetin interfaceSolrSuggestionStorageService- Parameters:
context- the DSpace Contextsource- the source nametarget- the target id- Returns:
- the suggestion target, if any
- Throws:
org.apache.solr.client.solrj.SolrServerExceptionIOException
-