
[英]TemporaryBackendException while using JanusGraph Java API and HBase
[英]search Hbase record using java API?
我想在Java中搜索基于值和我的应用程序的记录
我使用下面的代码存储记录
HTable table = new HTable(conf, tableName);
Put put = new Put(Bytes.toBytes(rowKey));
put.add(Bytes.toBytes(family), Bytes.toBytes(qualifier),
Bytes.toBytes(value));
table.put(put);
我传递价值观
Put put = new Put(Bytes.toBytes("rowkey"));
put.add(Bytes.toBytes("family1"), Bytes.toBytes("qualifier1"),
Bytes.toBytes("this is test record"));
这是我的实现
Get get = new Get(Bytes.toBytes("rowkey"));
String[] family = { "row1" };
get.addColumn(Bytes.toBytes("family1"),Bytes.toBytes("qualifier1"));
Result rs = table.get(get);
现在我想通过“这是测试记录”值来搜索此记录。
帮我找到这个记录。
使用过滤器可以搜索任何元素,并且可以为SubstringComparator BinaryComparator传递不同的组合
FilterList flist = new FilterList();
flist.addFilter(new RowFilter(CompareOp.EQUAL, new BinaryComparator(Bytes.toBytes("Predicatevalue"))));
flist.addFilter(new QualifierFilter(CompareOp.EQUAL,new BinaryComparator(Bytes.toBytes("Subject value"))));
flist.addFilter(new ValueFilter(CompareOp.EQUAL,new BinaryComparator(Bytes.toBytes("Objectvalue"))));
这对我有用。
查看HTable
上的get()
方法和Get类,它类似于HTable
和Put
类上的put()
方法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.