Beispiel #1
0
 /**
  * Terms counter.
  *
  * @param termSpec the term spec
  * @return the counter
  */
 default Counter<String> terms(@NonNull TermSpec termSpec) {
   return termSpec
       .getValueCalculator()
       .adjust(
           new HashMapCounter<>(
               stream()
                   .flatMap(
                       doc ->
                           doc.get(termSpec.getAnnotationType())
                               .stream()
                               .filter(termSpec.getFilter())
                               .map(termSpec.getToStringFunction())
                               .collect(Collectors.toList()))
                   .countByValue()));
 }
Beispiel #2
0
 /**
  * Terms counter.
  *
  * @return the counter
  */
 default Counter<String> terms() {
   return terms(TermSpec.create());
 }