java: public static WeightedTerm[] getTerms(Query query, boolean prohibited, String fieldName) {HashSet<WeightedTerm> terms = new HashSet<>();Predicate<String> fieldSelector = fieldName == null ? f -> true : fieldName::equals;query.visit(new BoostedTermExtractor(1, terms, prohibited, fieldSelector));return terms.toArray(new WeightedTerm[0]);}
C#: public static WeightedTerm[] GetTerms(Query query, bool prohibited, string fieldName){var terms = new JCG.HashSet<WeightedTerm>();if (fieldName != null){fieldName = fieldName.Intern();}GetTerms(query, terms, prohibited, fieldName);return terms.ToArray();}