// Customize Carrot2's resource lookup to first look for resources
// using Solr's resource loader. If that fails, try loading from the classpath.
DefaultLexicalDataFactoryDescriptor.attributeBuilder(initAttributes)
.resourceLookup(new ResourceLookup(new IResourceLocator() {
public IResource[] getAll(final String resource) {
final SolrResourceLoader resourceLoader = core.getResourceLoader();
final String carrot2ResourcesDir = resourceLoader.getConfigDir()
+ initParams.get(CarrotParams.LEXICAL_RESOURCES_DIR, CARROT_RESOURCES_PREFIX);
try {
log.debug("Looking for " + resource + " in "
+ carrot2ResourcesDir);
final InputStream resourceStream = resourceLoader
.openResource(carrot2ResourcesDir + "/" + resource);
log.info(resource + " loaded from " + carrot2ResourcesDir);
final IResource foundResource = new IResource() {
public InputStream open() throws IOException {