vendredi 6 mars 2015

Lucene 5.0 UnsupportedOperationException



I use Lucene 5.0 and I want to add my own stopwords.



CharArraySet stopSet = StandardAnalyzer.STOP_WORDS_SET;
stopSet.add("i");
stopSet.add("m");
stopSet.add("t");
stopSet.add("can");
stopSet.add("said");
tokenStream = new StopFilter(tokenStream, stopSet);


And this found in how to add custom stop words using lucene in java. But it does not work in my work. The problem is as follows.



Exception in thread "main" java.lang.UnsupportedOperationException
at org.apache.lucene.analysis.util.CharArrayMap$UnmodifiableCharArrayMap.put(CharArrayMap.java:606)
at org.apache.lucene.analysis.util.CharArraySet.add(CharArraySet.java:115)
at Main.main(Main.java:23)


How could I solve it. Thanks very much.




Aucun commentaire:

Enregistrer un commentaire