コード例 #1
0
  @Before
  public void setup() {
    conf = new Configuration();
    DatabaseAdapter inMemDB = new InMemoryDB();

    // Set the database adapter conf
    Index.setDatabaseAdapter(conf, InMemoryDB.class);

    // Create the term based index
    termIndex = new TermBasedIndex();
    termIndex.setConf(conf);
    Index.setIndexTable(indexTableName, conf);
    Index.setColumnFamily(colFam1, conf);
    Index.setColumnQualifier(colQual1, conf);

    // Create a new Put object with the value
    CKeyValue keyValue =
        new CKeyValue(rowId.getBytes(), colFam1.getBytes(), colQual1.getBytes(), value1.getBytes());
    Put put = new Put(keyValue);

    // Insert the data
    termIndex.handlePut(put);
  }