/** * Obtains stop words for a field from the associated * {@link StopFilterFactory}, if any. */ private Collection<CharArraySet> getSolrStopWordsForField(String fieldName) { // No need to synchronize here, Carrot2 ensures that instances // of this class are not used by multiple threads at a time. if (!solrStopWords.containsKey(fieldName)) { final Analyzer fieldAnalyzer = core.getLatestSchema().getFieldType(fieldName) .getIndexAnalyzer(); if (fieldAnalyzer instanceof TokenizerChain) { final TokenFilterFactory[] filterFactories = ((TokenizerChain) fieldAnalyzer) .getTokenFilterFactories(); for (TokenFilterFactory factory : filterFactories) { if (factory instanceof StopFilterFactory) { // StopFilterFactory holds the stop words in a CharArraySet solrStopWords.put(fieldName, ((StopFilterFactory) factory).getStopWords()); } if (factory instanceof CommonGramsFilterFactory) { solrStopWords.put(fieldName, ((CommonGramsFilterFactory) factory) .getCommonWords()); } } } } return solrStopWords.get(fieldName); }
/** * Obtains stop words for a field from the associated * {@link StopFilterFactory}, if any. */ private Collection<CharArraySet> getSolrStopWordsForField(String fieldName) { // No need to synchronize here, Carrot2 ensures that instances // of this class are not used by multiple threads at a time. if (!solrStopWords.containsKey(fieldName)) { final Analyzer fieldAnalyzer = schema.getFieldType(fieldName) .getAnalyzer(); if (fieldAnalyzer instanceof TokenizerChain) { final TokenFilterFactory[] filterFactories = ((TokenizerChain) fieldAnalyzer) .getTokenFilterFactories(); for (TokenFilterFactory factory : filterFactories) { if (factory instanceof StopFilterFactory) { // StopFilterFactory holds the stop words in a CharArraySet solrStopWords.put(fieldName, ((StopFilterFactory) factory).getStopWords()); } if (factory instanceof CommonGramsFilterFactory) { solrStopWords.put(fieldName, ((CommonGramsFilterFactory) factory) .getCommonWords()); } } } } return solrStopWords.get(fieldName); }
/** * Obtains stop words for a field from the associated * {@link StopFilterFactory}, if any. */ private Collection<CharArraySet> getSolrStopWordsForField(String fieldName) { // No need to synchronize here, Carrot2 ensures that instances // of this class are not used by multiple threads at a time. if (!solrStopWords.containsKey(fieldName)) { final Analyzer fieldAnalyzer = core.getLatestSchema().getFieldType(fieldName) .getAnalyzer(); if (fieldAnalyzer instanceof TokenizerChain) { final TokenFilterFactory[] filterFactories = ((TokenizerChain) fieldAnalyzer) .getTokenFilterFactories(); for (TokenFilterFactory factory : filterFactories) { if (factory instanceof StopFilterFactory) { // StopFilterFactory holds the stop words in a CharArraySet solrStopWords.put(fieldName, ((StopFilterFactory) factory).getStopWords()); } if (factory instanceof CommonGramsFilterFactory) { solrStopWords.put(fieldName, ((CommonGramsFilterFactory) factory) .getCommonWords()); } } } } return solrStopWords.get(fieldName); }