
org.dspace.discovery.SolrServiceSpellIndexingPlugin Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of dspace-api Show documentation
Show all versions of dspace-api Show documentation
DSpace core data model and service APIs.
The newest version!
/**
* The contents of this file are subject to the license and copyright
* detailed in the LICENSE and NOTICE files at the root of the source
* tree and available online at
*
* http://www.dspace.org/license/
*/
package org.dspace.discovery;
import java.util.List;
import org.apache.solr.common.SolrInputDocument;
import org.dspace.content.Item;
import org.dspace.content.MetadataValue;
import org.dspace.content.service.ItemService;
import org.dspace.core.Context;
import org.dspace.discovery.indexobject.IndexableItem;
import org.springframework.beans.factory.annotation.Autowired;
/**
* Created with IntelliJ IDEA.
* User: kevin
* Date: 03/10/13
* Time: 15:06
* To change this template use File | Settings | File Templates.
*/
public class SolrServiceSpellIndexingPlugin implements SolrServiceIndexPlugin {
@Autowired(required = true)
protected ItemService itemService;
@Override
public void additionalIndex(Context context, IndexableObject indexableObject, SolrInputDocument document) {
if (indexableObject instanceof IndexableItem) {
Item item = ((IndexableItem) indexableObject).getIndexedObject();
List dcValues = itemService.getMetadata(item, Item.ANY, Item.ANY, Item.ANY, Item.ANY);
List toIgnoreMetadataFields = SearchUtils.getIgnoredMetadataFields(item.getType());
for (MetadataValue dcValue : dcValues) {
if (!toIgnoreMetadataFields.contains(dcValue.getMetadataField().toString('.'))) {
document.addField("a_spell", dcValue.getValue());
}
}
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy