@Override
    void encodeBlueprint(ByteBuffer buffer) {
        boolean sameIndex = startIndex.equals(endIndex);
        byte metadata = 0;
        if (sameIndex)      metadata |= 0b00000001;
        if (startInclusive) metadata |= 0b00000010;
        if (endInclusive)   metadata |= 0b00000100;

        encoder = type.encoderFor(sortedRanges());
        metadata |= (byte)(encoder.id << 3);

        buffer.put(metadata);
        putString(startIndex, buffer);
        if ( ! sameIndex) putString(endIndex, buffer);
    }
Assumption: first.start <= second.start
Then there is overlap if
first.end  > second.start
first.end == second.start AND either of
  ranges are inclusive at either end, OR
  either range is a (logically empty) point (a, a), since this dominated by (or equal to) the other range.
container-search/src/main/java/com/yahoo/prelude/query/MultiRangeItem.java