[DS-1683] Add spell checker to discovery

This commit is contained in:
KevinVdV
2013-10-04 10:26:38 +02:00
parent 3db23c0987
commit 7dbd71543b
14 changed files with 185 additions and 31 deletions

View File

@@ -0,0 +1,29 @@
package org.dspace.discovery;
import org.apache.solr.common.SolrInputDocument;
import org.dspace.content.DCValue;
import org.dspace.content.DSpaceObject;
import org.dspace.content.Item;
import org.dspace.core.Context;
/**
* 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 {
@Override
public void additionalIndex(Context context, DSpaceObject dso, SolrInputDocument document) {
if(dso instanceof Item){
DCValue[] dcValues = ((Item) dso).getMetadata(Item.ANY, Item.ANY, Item.ANY, Item.ANY);
for (DCValue dcValue : dcValues) {
document.addField("a_spell", dcValue.value);
}
}
}
}