|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.dspace.discovery.SolrServiceImpl
@Service public class SolrServiceImpl
SolrIndexer contains the methods that index Items and their metadata, collections, communities, etc. It is meant to either be invoked from the command line (see dspace/bin/index-all) or via the indexContent() methods within DSpace.
The Administrator can choose to run SolrIndexer in a cron that repeats regularly, a failed attempt to index from the UI will be "caught" up on in that cron. The SolrServiceImple is registered as a Service in the ServiceManager via A spring configuration file located under classpath://spring/spring-dspace-applicationContext.xml Its configuration is Autowired by the ApplicationContext
| Field Summary | |
|---|---|
static String |
FILTER_SEPARATOR
|
| Constructor Summary | |
|---|---|
SolrServiceImpl()
|
|
| Method Summary | |
|---|---|
void |
cleanIndex(boolean force)
Iterates over all documents in the Lucene index and verifies they are in database, if not, they are removed. |
void |
createIndex(Context c)
create full index - wiping old index |
protected org.apache.solr.client.solrj.impl.CommonsHttpSolrServer |
getSolr()
Non-Static Singelton instance of Configuration Service |
void |
indexContent(Context context,
DSpaceObject dso)
If the handle for the "dso" already exists in the index, and the "dso" has a lastModified timestamp that is newer than the document in the index then it is updated, otherwise a new document is added. |
void |
indexContent(Context context,
DSpaceObject dso,
boolean force)
If the handle for the "dso" already exists in the index, and the "dso" has a lastModified timestamp that is newer than the document in the index then it is updated, otherwise a new document is added. |
static String |
locationToName(Context context,
String field,
String value)
|
void |
optimize()
Maintenance to keep a SOLR index efficient. |
void |
reIndexContent(Context context,
DSpaceObject dso)
reIndexContent removes something from the index, then re-indexes it |
DiscoverResult |
search(Context context,
DiscoverQuery discoveryQuery)
|
DiscoverResult |
search(Context context,
DSpaceObject dso,
DiscoverQuery discoveryQuery)
|
List<DSpaceObject> |
search(Context context,
String query,
int offset,
int max,
String... filterquery)
|
List<DSpaceObject> |
search(Context context,
String query,
String orderfield,
boolean ascending,
int offset,
int max,
String... filterquery)
|
InputStream |
searchAsInputStream(DiscoverQuery query)
Simple means to return the search result as an InputStream |
String |
searchJSON(DiscoverQuery query,
DSpaceObject dso,
String jsonIdentifier)
|
String |
searchJSON(DiscoverQuery query,
String jsonIdentifier)
|
static Date |
toDate(String t)
Helper function to retrieve a date using a best guess of the potential date encodings on a field |
DiscoverFilterQuery |
toFilterQuery(Context context,
String filterQuery)
|
DiscoverFilterQuery |
toFilterQuery(Context context,
String field,
String value)
|
String |
toSortFieldIndex(String metadataField,
String type)
|
void |
unIndexContent(Context context,
DSpaceObject dso)
unIndex removes an Item, Collection, or Community only works if the DSpaceObject has a handle (uses the handle for its unique ID) |
void |
unIndexContent(Context context,
String handle)
Unindex a Document in the Lucene index. |
void |
unIndexContent(Context context,
String handle,
boolean commit)
Unindex a Document in the Lucene Index. |
void |
updateIndex(Context context)
Iterates over all Items, Collections and Communities. |
void |
updateIndex(Context context,
boolean force)
Iterates over all Items, Collections and Communities. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String FILTER_SEPARATOR
| Constructor Detail |
|---|
public SolrServiceImpl()
| Method Detail |
|---|
protected org.apache.solr.client.solrj.impl.CommonsHttpSolrServer getSolr()
throws MalformedURLException,
org.apache.solr.client.solrj.SolrServerException
MalformedURLException
org.apache.solr.client.solrj.SolrServerException
public void indexContent(Context context,
DSpaceObject dso)
throws SQLException
indexContent in interface IndexingServicecontext - Users Contextdso - DSpace Object (Item, Collection or Community
SQLException
IOException
public void indexContent(Context context,
DSpaceObject dso,
boolean force)
throws SQLException
indexContent in interface IndexingServicecontext - Users Contextdso - DSpace Object (Item, Collection or Communityforce - Force update even if not stale.
SQLException
IOException
public void unIndexContent(Context context,
DSpaceObject dso)
throws SQLException,
IOException
unIndexContent in interface IndexingServicecontext - dso - DSpace Object, can be Community, Item, or Collection
SQLException
IOException
public void unIndexContent(Context context,
String handle)
throws IOException,
SQLException
unIndexContent in interface IndexingServicecontext - the dspace contexthandle - the handle of the object to be deleted
IOException
SQLException
public void unIndexContent(Context context,
String handle,
boolean commit)
throws SQLException,
IOException
unIndexContent in interface IndexingServicecontext - the dspace contexthandle - the handle of the object to be deleted
SQLException
IOException
public void reIndexContent(Context context,
DSpaceObject dso)
throws SQLException,
IOException
reIndexContent in interface IndexingServicecontext - context objectdso - object to re-index
SQLException
IOException
public void createIndex(Context c)
throws SQLException,
IOException
createIndex in interface IndexingServicec - context to use
SQLException
IOExceptionpublic void updateIndex(Context context)
updateIndex in interface IndexingServicecontext - the dspace context
public void updateIndex(Context context,
boolean force)
updateIndex in interface IndexingServicecontext - the dspace contextforce - whether or not to force the reindexing
public void cleanIndex(boolean force)
throws IOException,
SQLException,
SearchServiceException
cleanIndex in interface IndexingServiceforce - whether or not to force a clean index
IOException - IO exception
SQLException - sql exception
SearchServiceException - occurs when something went wrong with querying the solr serverpublic void optimize()
optimize in interface IndexingServicepublic static Date toDate(String t)
t - the string to be transformed to a date
public static String locationToName(Context context,
String field,
String value)
throws SQLException
SQLException
public DiscoverResult search(Context context,
DSpaceObject dso,
DiscoverQuery discoveryQuery)
throws SearchServiceException
search in interface SearchServiceSearchServiceException
public DiscoverResult search(Context context,
DiscoverQuery discoveryQuery)
throws SearchServiceException
search in interface SearchServiceSearchServiceException
public String searchJSON(DiscoverQuery query,
DSpaceObject dso,
String jsonIdentifier)
throws SearchServiceException
searchJSON in interface SearchServiceSearchServiceException
public String searchJSON(DiscoverQuery query,
String jsonIdentifier)
throws SearchServiceException
searchJSON in interface SearchServiceSearchServiceException
public InputStream searchAsInputStream(DiscoverQuery query)
throws SearchServiceException,
IOException
SearchServiceException
IOException
public List<DSpaceObject> search(Context context,
String query,
int offset,
int max,
String... filterquery)
public List<DSpaceObject> search(Context context,
String query,
String orderfield,
boolean ascending,
int offset,
int max,
String... filterquery)
search in interface SearchService
public DiscoverFilterQuery toFilterQuery(Context context,
String filterQuery)
throws SQLException
toFilterQuery in interface SearchServiceSQLException
public DiscoverFilterQuery toFilterQuery(Context context,
String field,
String value)
throws SQLException
toFilterQuery in interface SearchServiceSQLException
public String toSortFieldIndex(String metadataField,
String type)
toSortFieldIndex in interface SearchService
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||