throws QueryException {
// examine each clause in the Nutch query
Clause[] clauses = input.getClauses();
for (int i = 0; i < clauses.length; i++) {
Clause c = clauses[i];
// skip non-matching clauses
if (!c.getField().equals(field))
continue;
// get the field value from the clause
// raw fields are guaranteed to be Terms, not Phrases
String value = c.getTerm().toString();
if (lowerCase)
value = value.toLowerCase();
// add a Lucene TermQuery for this clause
TermQuery clause = new TermQuery(new Term(field, value));
// set boost
clause.setBoost(boost);
// add it as specified in query
output.add(clause,
(c.isProhibited()
? BooleanClause.Occur.MUST_NOT
: (c.isRequired()
? BooleanClause.Occur.MUST
: BooleanClause.Occur.SHOULD
)
));
}