Examples of ClasspathResourceLoader


Examples of org.apache.lucene.analysis.util.ClasspathResourceLoader

   */
  public void testHyphenationWithDictionary() throws Exception {
    Reader reader = new StringReader("min veninde som er lidt af en læsehest");
    Tokenizer tokenizer = new MockTokenizer(reader, MockTokenizer.WHITESPACE, false);
    HyphenationCompoundWordTokenFilterFactory factory = new HyphenationCompoundWordTokenFilterFactory();
    ResourceLoader loader = new ClasspathResourceLoader(getClass());
    Map<String,String> args = new HashMap<String,String>();
    args.put("hyphenator", "da_UTF8.xml");
    args.put("dictionary", "da_compoundDictionary.txt");
    factory.setLuceneMatchVersion(TEST_VERSION_CURRENT);
    factory.init(args);
View Full Code Here

Examples of org.apache.lucene.analysis.util.ClasspathResourceLoader

   */
  public void testHyphenationOnly() throws Exception {
    Reader reader = new StringReader("basketballkurv");
    Tokenizer tokenizer = new MockTokenizer(reader, MockTokenizer.WHITESPACE, false);
    HyphenationCompoundWordTokenFilterFactory factory = new HyphenationCompoundWordTokenFilterFactory();
    ResourceLoader loader = new ClasspathResourceLoader(getClass());
    Map<String,String> args = new HashMap<String,String>();
    args.put("hyphenator", "da_UTF8.xml");
    args.put("minSubwordSize", "2");
    args.put("maxSubwordSize", "4");
    factory.setLuceneMatchVersion(TEST_VERSION_CURRENT);
View Full Code Here

Examples of org.apache.lucene.analysis.util.ClasspathResourceLoader

  public void testElision() throws Exception {
    Reader reader = new StringReader("l'avion");
    Tokenizer tokenizer = new MockTokenizer(reader, MockTokenizer.WHITESPACE, false);
    ElisionFilterFactory factory = new ElisionFilterFactory();
    factory.setLuceneMatchVersion(TEST_VERSION_CURRENT);
    ResourceLoader loader = new ClasspathResourceLoader(getClass());
    Map<String,String> args = new HashMap<String,String>();
    args.put("articles", "frenchArticles.txt");
    factory.init(args);
    factory.inform(loader);
    TokenStream stream = factory.create(tokenizer);
View Full Code Here

Examples of org.apache.lucene.analysis.util.ClasspathResourceLoader

    Tokenizer tokenizer = new MockTokenizer(reader, MockTokenizer.WHITESPACE, false);
    ElisionFilterFactory factory = new ElisionFilterFactory();
    factory.setLuceneMatchVersion(TEST_VERSION_CURRENT);
    Map<String, String> args = Collections.emptyMap();
    factory.init(args);
    ResourceLoader loader = new ClasspathResourceLoader(getClass());
    factory.inform(loader);
    TokenStream stream = factory.create(tokenizer);
    assertTokenStreamContents(stream, new String[] { "avion" });
  }
View Full Code Here

Examples of org.apache.lucene.analysis.util.ClasspathResourceLoader

  public void testCaseInsensitive() throws Exception {
    Reader reader = new StringReader("L'avion");
    Tokenizer tokenizer = new MockTokenizer(reader, MockTokenizer.WHITESPACE, false);
    ElisionFilterFactory factory = new ElisionFilterFactory();
    factory.setLuceneMatchVersion(TEST_VERSION_CURRENT);
    ResourceLoader loader = new ClasspathResourceLoader(getClass());
    Map<String,String> args = new HashMap<String,String>();
    args.put("articles", "frenchArticles.txt");
    args.put("ignoreCase", "true");
    factory.init(args);
    factory.inform(loader);
View Full Code Here

Examples of org.apache.lucene.analysis.util.ClasspathResourceLoader

    Map<String,String> args = new HashMap<String,String>();
    args.put("dictionary", "test.dic");
    args.put("affix", "test.aff");
    factory.setLuceneMatchVersion(TEST_VERSION_CURRENT);
    factory.init(args);
    factory.inform(new ClasspathResourceLoader(getClass()));
   
    Reader reader = new StringReader("abc");
    TokenStream stream = factory.create(new MockTokenizer(reader, MockTokenizer.WHITESPACE, false));
    assertTokenStreamContents(stream, new String[] { "ab" });
  }
View Full Code Here

Examples of org.apache.lucene.analysis.util.ClasspathResourceLoader

    try {
      factory.setLuceneMatchVersion(TEST_VERSION_CURRENT);
      factory.init(Collections.<String,String>emptyMap());
      if (factory instanceof ResourceLoaderAware) {
        ResourceLoaderAware resourceLoaderAware = (ResourceLoaderAware) factory;
          resourceLoaderAware.inform(new ClasspathResourceLoader(factory.getClass()));
      }
      success = true;
    } catch (IllegalArgumentException ignored) {
      // its ok if we dont provide the right parameters to throw this
    }
View Full Code Here

Examples of org.apache.lucene.analysis.util.ClasspathResourceLoader

*
**/
public class TestKeepFilterFactory extends BaseTokenStreamTestCase {

  public void testInform() throws Exception {
    ResourceLoader loader = new ClasspathResourceLoader(getClass());
    assertTrue("loader is null and it shouldn't be", loader != null);
    KeepWordFilterFactory factory = new KeepWordFilterFactory();
    Map<String, String> args = new HashMap<String, String>();
    args.put("words", "keep-1.txt");
    args.put("ignoreCase", "true");
View Full Code Here

Examples of org.apache.lucene.analysis.util.ClasspathResourceLoader

* so this won't break if stop filter test files change
**/
public class TestCommonGramsQueryFilterFactory extends BaseTokenStreamTestCase {

  public void testInform() throws Exception {
    ResourceLoader loader = new ClasspathResourceLoader(TestStopFilter.class);
    assertTrue("loader is null and it shouldn't be", loader != null);
    CommonGramsQueryFilterFactory factory = new CommonGramsQueryFilterFactory();
    Map<String, String> args = new HashMap<String, String>();
    args.put("words", "stop-1.txt");
    args.put("ignoreCase", "true");
View Full Code Here

Examples of org.apache.lucene.analysis.util.ClasspathResourceLoader

 
  /**
   * If no words are provided, then a set of english default stopwords is used.
   */
  public void testDefaults() throws Exception {
    ResourceLoader loader = new ClasspathResourceLoader(TestStopFilter.class);
    assertTrue("loader is null and it shouldn't be", loader != null);
    CommonGramsQueryFilterFactory factory = new CommonGramsQueryFilterFactory();
    factory.setLuceneMatchVersion(TEST_VERSION_CURRENT);
    Map<String, String> args = Collections.emptyMap();
    factory.init(args);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.