コード例 #1
0
 /** {@inheritDoc} */
 public void setNextReader(LeafReaderContext ctx) throws IOException {
   if (valueSource == null) {
     // first time we've collected local values, get the right ValueSource
     valueSource = (null == ft) ? statsField.getValueSource() : ft.getValueSource(sf, null);
     vsContext = ValueSource.newContext(statsField.getSearcher());
   }
   values = valueSource.getValues(vsContext, ctx);
 }
コード例 #2
0
 /** {@inheritDoc} */
 @Override
 public void accumulate(BytesRef value, int count) {
   if (null == ft) {
     throw new IllegalStateException(
         "Can't collect & convert BytesRefs on stats that do't use a a FieldType: " + statsField);
   }
   T typedValue = (T) ft.toObject(sf, value);
   accumulate(typedValue, count);
 }