Example usage for org.apache.lucene.analysis.util ClasspathResourceLoader ClasspathResourceLoader

List of usage examples for org.apache.lucene.analysis.util ClasspathResourceLoader ClasspathResourceLoader

Introduction

In this page you can find the example usage for org.apache.lucene.analysis.util ClasspathResourceLoader ClasspathResourceLoader.

Prototype

@Deprecated
@SuppressForbidden(reason = "Deprecated method uses thread's context classloader, but there for backwards compatibility")
public ClasspathResourceLoader() 

Source Link

Document

Creates an instance using the context classloader to load resources and classes.

Usage

From source file:org.apache.jackrabbit.oak.plugins.index.lucene.NodeStateAnalyzerFactoryTest.java

License:Apache License

@Test
public void nodeStateResourceLoader() throws Exception {
    byte[] testData = "hello".getBytes();
    NodeBuilder nb = EMPTY_NODE.builder();
    createFileNode(nb, "foo", testData);

    NodeStateResourceLoader loader = new NodeStateResourceLoader(nb.getNodeState(),
            new ClasspathResourceLoader());
    assertArrayEquals(testData, IOUtils.toByteArray(loader.openResource("foo")));
}

From source file:org.wltea.analyzer.lucene.SynIKAnalyzer.java

License:Apache License

/**
 * ???/*from   www  .j av  a2 s  .co m*/
 */
public void initalSynonmFilter() {
    argsMap = new HashMap<String, String>();
    argsMap.put("expand", "true");
    argsMap.put("synonyms", "synonyms.txt");
    argsMap.put("autoupdate", "false");
    argsMap.put("flushtime", "10");
    try {
        syfilter = new IKSynonymFilterFactory(argsMap);
        syfilter.inform(new ClasspathResourceLoader());
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}