@Test public void testQueryCopiedToMulti() { SchemaField field = h.getCore().getLatestSchema().getField("content_charfilter"); Analyzer analyzer = ((TextField)field.getType()).getMultiTermAnalyzer(); assertTrue(analyzer instanceof TokenizerChain); assertTrue(((TokenizerChain) analyzer).getTokenizerFactory() instanceof KeywordTokenizerFactory); TokenizerChain tc = (TokenizerChain) analyzer; for (TokenFilterFactory factory : tc.getTokenFilterFactories()) { assertTrue(factory instanceof LowerCaseFilterFactory); } assertTrue(tc.getCharFilterFactories().length == 1); assertTrue(tc.getCharFilterFactories()[0] instanceof MappingCharFilterFactory); }
@Test public void testQueryCopiedToMulti() { SchemaField field = h.getCore().getSchema().getField("content_charfilter"); Analyzer analyzer = ((TextField)field.getType()).getMultiTermAnalyzer(); assertTrue(analyzer instanceof TokenizerChain); assertTrue(((TokenizerChain) analyzer).getTokenizerFactory() instanceof KeywordTokenizerFactory); TokenizerChain tc = (TokenizerChain) analyzer; for (TokenFilterFactory factory : tc.getTokenFilterFactories()) { assertTrue(factory instanceof LowerCaseFilterFactory); } assertTrue(tc.getCharFilterFactories().length == 1); assertTrue(tc.getCharFilterFactories()[0] instanceof MappingCharFilterFactory); }
@BeforeClass public static void setUp() throws Exception { Map<String, String> map = new HashMap<String, String>(); map.put("mapping", "mapping.txt"); charFilterFactory = new MappingCharFilterFactory(map); charFilterFactory.inform(new FilesystemResourceLoader(new File( "src/test/resources/cjkbigramfilter"))); tokenizerFactory = new CJKTokenizerFactory(new HashMap<String, String>()); map = new HashMap<String, String>(); map.put("outputUnigrams", "true"); tokenFilterFactory = new CJKBigramFilterFactory(map); }