mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-07 01:54:22 +00:00
Merge pull request #10352 from atmire/cli-speed-improvements-periodically-uncache-entities-when-processing-many_8-x
[Port dspace-8_x] Index discovery speed improvement - periodically uncache entities when processing many items
This commit is contained in:
@@ -75,6 +75,7 @@ import org.dspace.discovery.indexobject.IndexableCommunity;
|
||||
import org.dspace.discovery.indexobject.IndexableItem;
|
||||
import org.dspace.discovery.indexobject.factory.IndexFactory;
|
||||
import org.dspace.discovery.indexobject.factory.IndexObjectFactoryFactory;
|
||||
import org.dspace.discovery.indexobject.factory.ItemIndexFactory;
|
||||
import org.dspace.eperson.Group;
|
||||
import org.dspace.eperson.factory.EPersonServiceFactory;
|
||||
import org.dspace.eperson.service.GroupService;
|
||||
@@ -344,6 +345,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
|
||||
try {
|
||||
final List<IndexFactory> indexableObjectServices = indexObjectServiceFactory.
|
||||
getIndexFactories();
|
||||
int indexObject = 0;
|
||||
for (IndexFactory indexableObjectService : indexableObjectServices) {
|
||||
if (type == null || StringUtils.equals(indexableObjectService.getType(), type)) {
|
||||
final Iterator<IndexableObject> indexableObjects = indexableObjectService.findAll(context);
|
||||
@@ -351,6 +353,10 @@ public class SolrServiceImpl implements SearchService, IndexingService {
|
||||
final IndexableObject indexableObject = indexableObjects.next();
|
||||
indexContent(context, indexableObject, force);
|
||||
context.uncacheEntity(indexableObject.getIndexedObject());
|
||||
indexObject++;
|
||||
if ((indexObject % 100) == 0 && indexableObjectService instanceof ItemIndexFactory) {
|
||||
context.uncacheEntities();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user