I am migrating code from Lucene 3 to Lucene 4... and i have the following code
that i don't know how to change:
hits = searcher.search(queryGlobal, searcher.maxDoc(),
new Sort(new SortField(ordenarPor, SortField.STRING)));
I already change the searcher.maxDoc() to indxr.maxDoc() but SortField.STRING
does not exist anymore... what do i have to do?
In the same code i have a class called SpanishAnalyzer:
public class SpanishAnalyzer extends Analyzer {
public static final String[] SPANISH_STOP_WORDS = { "." };
private Set<Object> stopTable = new HashSet<Object>();
private Set<Object> exclTable = new HashSet<Object>();
public SpanishAnalyzer() {
stopTable =
StopFilter.makeStopSet(Version.LUCENE_40,SPANISH_STOP_WORDS);
}
public SpanishAnalyzer(Version version){
stopTable = StopFilter.makeStopSet(version,SPANISH_STOP_WORDS);
}
public SpanishAnalyzer(String[] stopWords) {
stopTable = StopFilter.makeStopSet(Version.LUCENE_40,stopWords);
}
public SpanishAnalyzer(File stopWords) throws IOException {
stopTable = new HashSet(WordlistLoader.getWordSet(new
FileReader(stopWords), Version.LUCENE_40));
}
// @Override
// public TokenStream tokenStream(String fieldName, Reader reader) {
// return new LowerCaseFilter(Version.LUCENE_40,new ASCIIFoldingFilter(
// new StopFilter(Version.LUCENE_40,
// new StandardTokenizer(Version.LUCENE_40,
// reader),
// stopTable)));
// }
@Override
protected TokenStreamComponents createComponents(String string, Reader
reader) {
throw new UnsupportedOperationException("Not supported yet.");
}
}
The problem is that i can't override TokenStream anymore and now i have to
implement the createComponents method and i am not sure what do i supposed to
do there... thanks in advance for both troubles.