Package org.apache.lucene.analysis

Examples of org.apache.lucene.analysis.CharArraySet$CharArraySetIterator


  protected CharArraySet getWordSet(ResourceLoader loader,
      String wordFiles, boolean ignoreCase) throws IOException {
    assureMatchVersion();
    List<String> files = StrUtils.splitFileNames(wordFiles);
    CharArraySet words = null;
    if (files.size() > 0) {
      // default stopwords list has 35 or so words, but maybe don't make it that
      // big to start
      words = new CharArraySet(luceneMatchVersion,
          files.size() * 10, ignoreCase);
      for (String file : files) {
        List<String> wlist = loader.getLines(file.trim());
        words.addAll(StopFilter.makeStopSet(luceneMatchVersion, wlist,
            ignoreCase));
      }
    }
    return words;
  }
View Full Code Here


  private final CharTermAttribute termAtt = addAttribute(CharTermAttribute.class);

  /** @deprecated Use {@link #KeepWordFilter(boolean, TokenStream, CharArraySet)} instead */
  @Deprecated
  public KeepWordFilter(TokenStream in, Set<String> words, boolean ignoreCase ) {
    this(false, in, new CharArraySet(words, ignoreCase));
  }
View Full Code Here

  public CommonGramsFilter(Version matchVersion, TokenStream input, Set<?> commonWords, boolean ignoreCase) {
    super(input);
    if (commonWords instanceof CharArraySet) {
      this.commonWords = (CharArraySet) commonWords;
    } else {
      this.commonWords = new CharArraySet(matchVersion, commonWords.size(), ignoreCase);
      this.commonWords.addAll(commonWords);
    }
  }
View Full Code Here

   * @return a Set containing the words
   * @deprecated create a CharArraySet with CharArraySet instead
   */
  @Deprecated
  public static CharArraySet makeCommonSet(String[] commonWords, boolean ignoreCase) {
    CharArraySet commonSet = new CharArraySet(commonWords.length, ignoreCase);
    commonSet.addAll(Arrays.asList(commonWords));
    return commonSet;
  }
View Full Code Here

import org.apache.lucene.analysis.CharArraySet;

public class TestCharArraySet extends LuceneTestCase
{
    public void testRehash() throws Exception {
      CharArraySet cas = new CharArraySet(0, true);
      for(int i=0;i<StopAnalyzer.ENGLISH_STOP_WORDS.length;i++)
        cas.add(StopAnalyzer.ENGLISH_STOP_WORDS[i]);
      assertEquals(StopAnalyzer.ENGLISH_STOP_WORDS.length, cas.size());
      for(int i=0;i<StopAnalyzer.ENGLISH_STOP_WORDS.length;i++)
        assertTrue(cas.contains(StopAnalyzer.ENGLISH_STOP_WORDS[i]));
    }
View Full Code Here

    this.onlyLongestMatch=onlyLongestMatch;
   
    if (dictionary instanceof CharArraySet) {
      this.dictionary = (CharArraySet) dictionary;
    } else {
      this.dictionary = new CharArraySet(dictionary.size(), false);
      addAllLowerCase(this.dictionary, dictionary);
    }
   
    termAtt = (TermAttribute) addAttribute(TermAttribute.class);
    offsetAtt = (OffsetAttribute) addAttribute(OffsetAttribute.class);
View Full Code Here

   * @param dictionary
   * @return {@link Set} of lowercased terms
   */
  public static final Set makeDictionary(final String[] dictionary) {
    // is the below really case insensitive?
    CharArraySet dict = new CharArraySet(dictionary.length, false);
    addAllLowerCase(dict, Arrays.asList(dictionary));
    return dict;
  }
View Full Code Here

    this.onlyLongestMatch=onlyLongestMatch;
   
    if (dictionary instanceof CharArraySet) {
      this.dictionary = (CharArraySet) dictionary;
    } else {
      this.dictionary = new CharArraySet(dictionary.size(), false);
      addAllLowerCase(this.dictionary, dictionary);
    }
   
    termAtt = (TermAttribute) addAttribute(TermAttribute.class);
    offsetAtt = (OffsetAttribute) addAttribute(OffsetAttribute.class);
View Full Code Here

   * @param dictionary
   * @return {@link Set} of lowercased terms
   */
  public static final Set makeDictionary(final String[] dictionary) {
    // is the below really case insensitive?
    CharArraySet dict = new CharArraySet(dictionary.length, false);
    addAllLowerCase(dict, Arrays.asList(dictionary));
    return dict;
  }
View Full Code Here

      this.enablePositionIncrements = enablePositionIncrements;
    }
    @Override
    public TokenStream tokenStream(String fieldName, Reader reader) {
      TokenStream ts = a.tokenStream(fieldName,reader);
      return new StopFilter(enablePositionIncrements, ts, new CharArraySet(Collections.singleton("stop"), true));
    }
View Full Code Here

TOP

Related Classes of org.apache.lucene.analysis.CharArraySet$CharArraySetIterator

Copyright © 2018 www.massapicom. 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.