InputStream dicInputStream = new FileInputStream(args[offset++]); HunspellDictionary dictionary = new HunspellDictionary(affixInputStream, dicInputStream, Version.LUCENE_34, ignoreCase);
@Inject public HunspellStemFilterFactory(Index index, @IndexSettings Settings indexSettings, @Assisted String name, @Assisted Settings settings) { super(index, indexSettings, name, settings); this.name = name; this.locale = settings.get("locale", "en_US"); this.ignoreCase = settings.getAsBoolean("ignoreCase", Boolean.TRUE); this.dedup = settings.getAsBoolean("dedup", Boolean.TRUE); if (!locales.contains(locale)) { throw new ElasticSearchException("invalid locale '" + locale + "' for hunspell aff/dic"); } try { InputStream affixStream = HunspellStemFilterFactory.class.getResourceAsStream(locale + ".aff"); InputStream dictStream = HunspellStemFilterFactory.class.getResourceAsStream(locale + ".dic"); this.dictionary = new HunspellDictionary(affixStream, dictStream, version, ignoreCase); affixStream.close(); dictStream.close(); } catch (IOException ex) { logger.error("hunspell aff/dic stream I/O error for locale " + locale, ex); } catch (ParseException ex) { logger.error("hunspell aff/dic stream parse failure for locale " + locale, ex); } }