* @param crit
* @return query
* @throws UnsupportedSearchException
*/
public static Query createFlagQuery(SearchQuery.FlagCriterion crit) throws UnsupportedSearchException {
Flag flag = crit.getFlag();
String value = flag.toString();
TermQuery query = new TermQuery(new Term(FLAGS_FIELD, value));
if (crit.getOperator().isSet()) {
return query;
} else {
// lucene does not support simple NOT queries so we do some nasty hack here