Examples of StopFilterFactory


Examples of org.apache.solr.analysis.StopFilterFactory

     * @param searchText search text
     * @param stopWordsFile file that contains stop words
     * @return result of filtration
     */
    private String filter(String searchText, String stopWordsFile) {
        StopFilterFactory filterFactory = new StopFilterFactory();
        Map<String, String> arguments = new HashMap<>();
        arguments.put("words", stopWordsFile);
        arguments.put("luceneMatchVersion", String.valueOf(Version.LUCENE_31));
        arguments.put("ignoreCase", String.valueOf(ignoreCase));
        filterFactory.init(arguments);
        filterFactory.inform(new HibernateSearchResourceLoader());
       
        Set<String> stopWords = (Set<String>)filterFactory.getStopWords();
        List<String> searchTerms = splitSearchText(searchText);
        searchTerms.removeAll(stopWords);
        return joinSearchTerms(searchTerms);
    }
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.