From 3477b0cfc0d0ce7ab7b506a9bcd73e19a69be2ca Mon Sep 17 00:00:00 2001 From: Jens Vannerum Date: Mon, 30 Dec 2024 15:52:42 +0100 Subject: [PATCH] 122485: Temporary disable ancestor discovery to test the impact on performance --- .../SolrServiceIndexItemEditorsPlugin.java | 12 +++--- .../SolrServiceResourceRestrictionPlugin.java | 3 +- .../indexobject/ItemIndexFactoryImpl.java | 37 ++++++++++--------- 3 files changed, 28 insertions(+), 24 deletions(-) diff --git a/dspace-api/src/main/java/org/dspace/discovery/SolrServiceIndexItemEditorsPlugin.java b/dspace-api/src/main/java/org/dspace/discovery/SolrServiceIndexItemEditorsPlugin.java index 09308be75920..4e4fe8ad2227 100644 --- a/dspace-api/src/main/java/org/dspace/discovery/SolrServiceIndexItemEditorsPlugin.java +++ b/dspace-api/src/main/java/org/dspace/discovery/SolrServiceIndexItemEditorsPlugin.java @@ -48,11 +48,13 @@ public void additionalIndex(Context context, IndexableObject idxObj, SolrInputDo // Community. // TODO: Strictly speaking we should also check for epersons who received admin rights directly, // without being part of the admin group. Finding them may be a lot slower though. - for (Collection collection : item.getCollections()) { - for (UUID unprefixedId : findTransitiveAdminGroupIds(context, collection)) { - document.addField("edit", "g" + unprefixedId); - } - } + // + // FIXME: Temporary disable ancestor discovery to test the impact on performance. + // for (Collection collection : item.getCollections()) { + // for (UUID unprefixedId : findTransitiveAdminGroupIds(context, collection)) { + // document.addField("edit", "g" + unprefixedId); + // } + // } // Index groups and epersons with WRITE or direct ADMIN rights on the Item. List prefixedIds = findDirectlyAuthorizedGroupAndEPersonPrefixedIds( diff --git a/dspace-api/src/main/java/org/dspace/discovery/SolrServiceResourceRestrictionPlugin.java b/dspace-api/src/main/java/org/dspace/discovery/SolrServiceResourceRestrictionPlugin.java index d19616a85e10..00dafbb9a1c1 100644 --- a/dspace-api/src/main/java/org/dspace/discovery/SolrServiceResourceRestrictionPlugin.java +++ b/dspace-api/src/main/java/org/dspace/discovery/SolrServiceResourceRestrictionPlugin.java @@ -126,7 +126,8 @@ public void additionalIndex(Context context, IndexableObject idxObj, SolrInputDo context.uncacheEntity(resourcePolicy); } } - dso = ContentServiceFactory.getInstance().getDSpaceObjectService(dso).getParentObject(context, dso); + // FIXME: Temporary disable ancestor discovery to test the impact on performance. + dso = null; } } catch (SQLException e) { log.error(LogHelper.getHeader(context, "Error while indexing resource policies", diff --git a/dspace-api/src/main/java/org/dspace/discovery/indexobject/ItemIndexFactoryImpl.java b/dspace-api/src/main/java/org/dspace/discovery/indexobject/ItemIndexFactoryImpl.java index 005f9b42472e..677850e832b5 100644 --- a/dspace-api/src/main/java/org/dspace/discovery/indexobject/ItemIndexFactoryImpl.java +++ b/dspace-api/src/main/java/org/dspace/discovery/indexobject/ItemIndexFactoryImpl.java @@ -645,25 +645,26 @@ public void writeDocument(Context context, IndexableItem indexableObject, SolrIn @Override public List getLocations(Context context, IndexableItem indexableDSpaceObject) throws SQLException { - final Item item = indexableDSpaceObject.getIndexedObject(); + // FIXME: Temporary disable ancestor discovery to test the impact on performance. List locations = new ArrayList<>(); - - // build list of community ids - List communities = itemService.getCommunities(context, item); - - // build list of collection ids - List collections = item.getCollections(); - - // now put those into strings - int i = 0; - - for (i = 0; i < communities.size(); i++) { - locations.add("m" + communities.get(i).getID()); - } - - for (i = 0; i < collections.size(); i++) { - locations.add("l" + collections.get(i).getID()); - } +// final Item item = indexableDSpaceObject.getIndexedObject(); +// +// // build list of community ids +// List communities = itemService.getCommunities(context, item); +// +// // build list of collection ids +// List collections = item.getCollections(); +// +// // now put those into strings +// int i = 0; +// +// for (i = 0; i < communities.size(); i++) { +// locations.add("m" + communities.get(i).getID()); +// } +// +// for (i = 0; i < collections.size(); i++) { +// locations.add("l" + collections.get(i).getID()); +// } return locations; }