TermBasedIndex extends Index { @Override public SeekingCurrentIterator handleGet(byte[] indexRangeStart, byte[] indexRangeEnd) { TableAdapter indexTable = getIndexTable(); byte[] end; if (indexRangeEnd.length != 0) { end = Arrays.copyOf(indexRangeEnd, indexRangeEnd.length + 1); end[end.length - 1] = 1; } else end = indexRangeEnd; Get get = new Get(new CRange(indexRangeStart, end)); return new TermBasedIndexIterator(indexTable.get(get)); } TermBasedIndex();  TermBasedIndex(String name, DatabaseAdapter database,
      String primaryTable, String indexTable, byte[] columnFamily,
      byte[] columnQualifier);  TermBasedIndex(String name, DatabaseAdapter database,
      Configuration databaseConf, String primaryTable, String indexTable,
      byte[] columnFamily, byte[] columnQualifier, boolean isSplittable,
      String regex); static void setTokenRegex(String regex, Configuration conf); static void setSplitable(boolean isSplitable, Configuration conf); static void setToLower(boolean isLowerable, Configuration conf); String getTokenRegex(); boolean getSplitable(); boolean getToLower(); @Override void handlePut(Put put); @Override SeekingCurrentIterator handleGet(byte[] indexRangeStart,
      byte[] indexRangeEnd); static final String DEFAULT_TOKEN_REGEX; static final int NUM_RECORD_ID_LENGTH_BYTES; static final int NUM_NULL_BYTES; static final byte[] NULL_BYTES_PADDING; }
@Test public void testGetAll() { SeekingCurrentIterator indexIterator = termIndex.handleGet(new byte[0], new byte[0]); int count = 0; while (indexIterator.hasNext()) { Result result = indexIterator.next(); count++; assertTrue(Bytes.compareTo(result.getRecordId(), rowIdBytes) == 0); } assertTrue(count == 3); }
@Test public void testGetSteve() { byte[] steveBytes = "steve".getBytes(); byte[] end = new byte[steveBytes.length + 1]; System.arraycopy(steveBytes, 0, end, 0, steveBytes.length); end[end.length - 1] = 0x01; SeekingCurrentIterator indexIterator = termIndex.handleGet(steveBytes, end); int count = 0; while (indexIterator.hasNext()) { Result result = indexIterator.next(); count++; assertTrue(Bytes.compareTo(result.getRecordId(), rowIdBytes) == 0); } assertTrue(count == 1); }