コード例 #1
0
  public LongFilter convertToLongFilter(DocValueFormat format) {

    if (isPartitionBased()) {
      return new PartitionedLongFilter();
    }

    int numValids = includeValues == null ? 0 : includeValues.size();
    int numInvalids = excludeValues == null ? 0 : excludeValues.size();
    SetBackedLongFilter result = new SetBackedLongFilter(numValids, numInvalids);
    if (includeValues != null) {
      for (BytesRef val : includeValues) {
        result.addAccept(format.parseLong(val.utf8ToString(), false, null));
      }
    }
    if (excludeValues != null) {
      for (BytesRef val : excludeValues) {
        result.addReject(format.parseLong(val.utf8ToString(), false, null));
      }
    }
    return result;
  }
コード例 #2
0
 private static SortedSet<BytesRef> parseForDocValues(
     SortedSet<BytesRef> endUserFormattedValues, DocValueFormat format) {
   SortedSet<BytesRef> result = endUserFormattedValues;
   if (endUserFormattedValues != null) {
     if (format != DocValueFormat.RAW) {
       result = new TreeSet<>();
       for (BytesRef formattedVal : endUserFormattedValues) {
         result.add(format.parseBytesRef(formattedVal.utf8ToString()));
       }
     }
   }
   return result;
 }