/** Test creating an elision filter without specifying any articles */ public void testDefaultArticles() 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); Map<String, String> args = Collections.emptyMap(); factory.init(args); ResourceLoader loader = new SolrResourceLoader(null, null); factory.inform(loader); TokenStream stream = factory.create(tokenizer); assertTokenStreamContents(stream, new String[] {"avion"}); }
/** Test setting ignoreCase=true */ 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 SolrResourceLoader(null, null); Map<String, String> args = new HashMap<String, String>(); args.put("articles", "frenchArticles.txt"); args.put("ignoreCase", "true"); factory.init(args); factory.inform(loader); TokenStream stream = factory.create(tokenizer); assertTokenStreamContents(stream, new String[] {"avion"}); }