diff --git a/metis-indexing/src/main/java/eu/europeana/indexing/Indexer.java b/metis-indexing/src/main/java/eu/europeana/indexing/Indexer.java index 5d3f0664d..d5b12785f 100644 --- a/metis-indexing/src/main/java/eu/europeana/indexing/Indexer.java +++ b/metis-indexing/src/main/java/eu/europeana/indexing/Indexer.java @@ -82,7 +82,10 @@ public interface Indexer extends Closeable { * * @param stringRdfRecord The record to index (can be parsed to RDF). * @param indexingProperties The properties of this indexing operation. - * @param tierResultsConsumer The predicate deciding if the record should be published based on evaluated tier. + * @param tierResultsConsumer The predicate deciding whether the record should be published based + * on the evaluated tier. Note: the tier calculations that are provided + * to the consumer are for provider data only (i.e. mode + * {@link eu.europeana.indexing.tiers.metadata.ClassifierMode#PROVIDER_PROXIES}). * @throws IndexingException In case a problem occurred during indexing. */ void index(String stringRdfRecord, IndexingProperties indexingProperties, @@ -131,7 +134,9 @@ void index(String stringRdfRecord, IndexingProperties indexingProperties, * @param recordContent The record to index (can be parsed to RDF). * @param indexingProperties The properties of this indexing operation. * @throws IndexingException In case a problem occurred during indexing. - * @return A pair with both content tier and metadata tier calculations results of the given record + * @return A pair with both content tier and metadata tier calculations results of the given + * record. The tier calculations are for provider data only (i.e. mode + * {@link eu.europeana.indexing.tiers.metadata.ClassifierMode#PROVIDER_PROXIES}). */ TierResults indexAndGetTierCalculations(InputStream recordContent, IndexingProperties indexingProperties) throws IndexingException; diff --git a/metis-indexing/src/main/java/eu/europeana/indexing/IndexerPreprocessor.java b/metis-indexing/src/main/java/eu/europeana/indexing/IndexerPreprocessor.java index 4ba8e00d2..3e24e2fba 100644 --- a/metis-indexing/src/main/java/eu/europeana/indexing/IndexerPreprocessor.java +++ b/metis-indexing/src/main/java/eu/europeana/indexing/IndexerPreprocessor.java @@ -33,7 +33,7 @@ private IndexerPreprocessor() { * * @param rdf the rdf * @param properties the properties - * @return the tier results + * @return the tier results for the provider data (i.e. {@link ClassifierMode#PROVIDER_PROXIES}). * @throws IndexingException the indexing exception */ public static TierResults preprocessRecord(RDF rdf, IndexingProperties properties) @@ -41,21 +41,21 @@ public static TierResults preprocessRecord(RDF rdf, IndexingProperties propertie // Perform the tier classification final RdfWrapper rdfWrapper = new RdfWrapper(rdf); - TierResults tierCalculationsResult = new TierResults(); if (properties.isPerformTierCalculation() && properties.getTypesEnabledForTierCalculation() .contains(rdfWrapper.getEdmType())) { - tierCalculationsResult = new TierResults(mediaClassifier.classify(rdfWrapper), - metadataClassifier.classify(rdfWrapper)); - RdfTierUtils.setTier(rdf, tierCalculationsResult.getMediaTier()); - RdfTierUtils.setTier(rdf, tierCalculationsResult.getMetadataTier()); - - tierCalculationsResult = new TierResults(mediaClassifier.classify(rdfWrapper), - metadataClassifierEuropeana.classify(rdfWrapper)); - RdfTierUtils.setTierEuropeana(rdf, tierCalculationsResult.getMediaTier()); - RdfTierUtils.setTierEuropeana(rdf, tierCalculationsResult.getMetadataTier()); + final TierResults tierCalculationsResultProvidedData = new TierResults( + mediaClassifier.classify(rdfWrapper), metadataClassifier.classify(rdfWrapper)); + RdfTierUtils.setTier(rdf, tierCalculationsResultProvidedData.getMediaTier()); + RdfTierUtils.setTier(rdf, tierCalculationsResultProvidedData.getMetadataTier()); + + final TierResults tierCalculationsResultEuropeana = new TierResults( + mediaClassifier.classify(rdfWrapper), metadataClassifierEuropeana.classify(rdfWrapper)); + RdfTierUtils.setTierEuropeana(rdf, tierCalculationsResultEuropeana.getMediaTier()); + RdfTierUtils.setTierEuropeana(rdf, tierCalculationsResultEuropeana.getMetadataTier()); + + return tierCalculationsResultProvidedData; } - return tierCalculationsResult; + return new TierResults(); } - } diff --git a/metis-indexing/src/main/java/eu/europeana/indexing/tiers/ClassifierFactory.java b/metis-indexing/src/main/java/eu/europeana/indexing/tiers/ClassifierFactory.java index af9836e08..3212b196d 100644 --- a/metis-indexing/src/main/java/eu/europeana/indexing/tiers/ClassifierFactory.java +++ b/metis-indexing/src/main/java/eu/europeana/indexing/tiers/ClassifierFactory.java @@ -26,7 +26,7 @@ private ClassifierFactory() { * @return A classifier for the metadata tier with Provider Proxies as default mode. */ public static TierClassifier getMetadataClassifier() { - return new MetadataClassifier(new LanguageClassifier(), new EnablingElementsClassifier(), new ContextualClassesClassifier()); + return getMetadataClassifier(ClassifierMode.PROVIDER_PROXIES); } /** diff --git a/metis-indexing/src/main/java/eu/europeana/indexing/tiers/metadata/ContextualClassesClassifier.java b/metis-indexing/src/main/java/eu/europeana/indexing/tiers/metadata/ContextualClassesClassifier.java index 5d56045e6..1d33407e4 100644 --- a/metis-indexing/src/main/java/eu/europeana/indexing/tiers/metadata/ContextualClassesClassifier.java +++ b/metis-indexing/src/main/java/eu/europeana/indexing/tiers/metadata/ContextualClassesClassifier.java @@ -37,7 +37,7 @@ public class ContextualClassesClassifier implements TierClassifierBreakdown