> Okay, think I have it now. Now have a working rewrite method for Fuzzy > Queries > > public static class FuzzyTermRewrite<Q extends DisjunctionMaxQuery> > extends TopTermsRewrite<Query> { > > public FuzzyTermRewrite(int size) { > super(size); > } > > @Override > protected int getMaxSize() { > return BooleanQuery.getMaxClauseCount(); > } > > @Override > protected DisjunctionMaxQuery getTopLevelQuery() { > return new DisjunctionMaxQuery(0.1f); > } > > @Override > protected void addClause(Query topLevel, Term term, int docCount, > float boost, TermContext states) { > final Query tq = new ConstantScoreQuery(new TermQuery(term, > states)); > tq.setBoost(boost); > ((DisjunctionMaxQuery)topLevel).add(tq); > } > } > > and now writing a separate class for Prefix Queries so it does actually modify > the idf
Hi, looks OK, only the generics are wrong, must be: public static class FuzzyTermRewrite extends TopTermsRewrite<DisjunctionMaxQuery> { And then: protected void addClause(DisjunctionMaxQuery topLevel, Term term, int docCount, float boost, TermContext states) { This cast is then obsolete: ((DisjunctionMaxQuery)topLevel).add(tq); Uwe --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org