diff --git a/indexer/src/main/java/au/org/aodn/esindexer/service/AodnDiscoveryParameterVocabService.java b/indexer/src/main/java/au/org/aodn/esindexer/service/AodnDiscoveryParameterVocabService.java index 6e792572..4c525c05 100644 --- a/indexer/src/main/java/au/org/aodn/esindexer/service/AodnDiscoveryParameterVocabService.java +++ b/indexer/src/main/java/au/org/aodn/esindexer/service/AodnDiscoveryParameterVocabService.java @@ -19,9 +19,6 @@ public class AodnDiscoveryParameterVocabService { @Autowired VocabsUtils cacheArdcVocabsUtils; - @Value("${elasticsearch.index.categories.name}") - String categoriesIndexName; - @Autowired ElasticsearchClient portalElasticsearchClient; @@ -52,7 +49,7 @@ comparing by combined values (id and url) of the concept object public List getAodnDiscoveryCategories(List themes) throws IOException { List results = new ArrayList<>(); // Iterate over the top-level vocabularies - for (JsonNode topLevelVocab : cacheArdcVocabsUtils.getDiscoveryCategories(categoriesIndexName)) { + for (JsonNode topLevelVocab : cacheArdcVocabsUtils.getDiscoveryCategories()) { if (topLevelVocab.has("narrower") && !topLevelVocab.get("narrower").isEmpty()) { for (JsonNode secondLevelVocab : topLevelVocab.get("narrower")) { String secondLevelVocabLabel = secondLevelVocab.get("label").asText(); diff --git a/indexer/src/main/java/au/org/aodn/esindexer/utils/VocabsUtils.java b/indexer/src/main/java/au/org/aodn/esindexer/utils/VocabsUtils.java index f13357fa..4ae7da28 100644 --- a/indexer/src/main/java/au/org/aodn/esindexer/utils/VocabsUtils.java +++ b/indexer/src/main/java/au/org/aodn/esindexer/utils/VocabsUtils.java @@ -112,7 +112,7 @@ public void refreshDiscoveryCategoriesIndex() throws IOException { @Cacheable(AppConstants.AODN_DISCOVERY_CATEGORIES_CACHE) // TODO research strategy to avoid multiple refresh runs at the same schedule by multiple indexer instances // A way to do it is read the value from Elastic search, if it has updated within say 24 hrs then use it - public List getDiscoveryCategories(String categoriesIndexName) throws IOException { + public List getDiscoveryCategories() throws IOException { List categories = new ArrayList<>(); log.info("Fetching AODN Discovery Parameter Vocabularies from {}", categoriesIndexName); try { @@ -140,7 +140,7 @@ public void refreshCache() throws IOException { log.info("Refreshing AODN Discovery Parameter Vocabularies cache"); clearCache(); this.refreshDiscoveryCategoriesIndex(); - self.getDiscoveryCategories(categoriesIndexName); + self.getDiscoveryCategories(); } @CacheEvict(value = AppConstants.AODN_DISCOVERY_CATEGORIES_CACHE, allEntries = true)