Hi
I am migrating from Lucene 3.6.1 to 4.3.0. I am however not sure how to migrate
my custom collector below to 4.3.0 (this page
http://lucene.apache.org/core/4_3_0/MIGRATE.html gives some hints but is the
instructions are incomplete and looking at the source examples of custom
collectors make me dizzy!!!)
Any advise would be very much appreciated
thank you
public class AllInLinks extends Collector {
private Scorer scorer;
private int docBase;
private String[] store;
private HashSet<String> outLinks = new HashSet<String>();
public boolean acceptsDocsOutOfOrder() {
return true;
}
public void setScorer(Scorer scorer) {
this.scorer = scorer;
}
public void setNextReader(IndexReader reader, int docBase)
throws IOException{
this.docBase = docBase;
store = FieldCache.DEFAULT.getStrings(reader,"title");
}
public void collect(int doc) throws IOException {
String page = store[doc];
outLinks.add(page);
}
public void reset() {
outLinks.clear();
store = null;
}
public int getOutLinks() {
return outLinks.size();
}
}