>>> Michael Bell 2/21/2012 12:18 PM >>>
I've ported over the various pieces from SOLR 3.5 (SolrQueryParser,
ReverseWildcardFilter, ReverseWildcardFactory).
But I do not understand how to apply this to indexing.
Here's the situation. Some fields will need StandardAnalyzer, some need
KeyWord, some need "SuperAnalyzer" (Standard+ReverseWildcardFilter).
Ok, most of that is easy enough - just use the PerFieldAnalyzerWrapper.
But how to create "SuperAnalyzer".
I started down the road of taking StandardAnalyzer and ReverseWildcardFilter in
the constructor of SuperAnalyzer which extends Analyzer,
but I started getting confused which methods to override and how to implement
them:
public class SuperAnalyzer extends Analyzer {
final private StandardAnalyzer standard;
final private ReversedWildcardFilterFactory filter;
public SuperAnalyzer(StandardAnalyzer
standard,ReversedWildcardFilterFactory filter) { // probably should use
Analyzer, TokenFilter for nice generic sig
this.standard=standard; this.filter=filter;
}
@Override
public int getPositionIncrementGap(String fieldName) {
return this.standard.getPositionIncrementGap(fieldName); // or
something else
}
@Override
public TokenStream tokenStream(String fieldName, Reader reader) { //
this looks ok
TokenStream ts=this.standard.tokenStream(fieldName, reader);
return this.filter.create(ts);
}
@Override
public TokenStream reusableTokenStream(String fieldName, Reader reader)
throws IOException {
return super.reusableTokenStream(fieldName, reader); // this looks
wrong, don't know how to fix
}
//
// other methods to override?
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]