Updated Branches: refs/heads/0.1.5 4ea509974 -> ff29884ab
Adding simple search example. Project: http://git-wip-us.apache.org/repos/asf/incubator-blur/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-blur/commit/ff29884a Tree: http://git-wip-us.apache.org/repos/asf/incubator-blur/tree/ff29884a Diff: http://git-wip-us.apache.org/repos/asf/incubator-blur/diff/ff29884a Branch: refs/heads/0.1.5 Commit: ff29884ab60262305b99af49fae26575c808b755 Parents: 4ea5099 Author: Aaron McCurry <[email protected]> Authored: Thu May 2 22:21:37 2013 -0400 Committer: Aaron McCurry <[email protected]> Committed: Thu May 2 22:21:37 2013 -0400 ---------------------------------------------------------------------- .../apache/blur/testsuite/SimpleQueryExample.java | 45 +++++++++++++++ 1 files changed, 45 insertions(+), 0 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/ff29884a/src/blur-testsuite/src/main/java/org/apache/blur/testsuite/SimpleQueryExample.java ---------------------------------------------------------------------- diff --git a/src/blur-testsuite/src/main/java/org/apache/blur/testsuite/SimpleQueryExample.java b/src/blur-testsuite/src/main/java/org/apache/blur/testsuite/SimpleQueryExample.java new file mode 100644 index 0000000..df16bd8 --- /dev/null +++ b/src/blur-testsuite/src/main/java/org/apache/blur/testsuite/SimpleQueryExample.java @@ -0,0 +1,45 @@ +package org.apache.blur.testsuite; + +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import java.io.IOException; + +import org.apache.blur.thrift.BlurClient; +import org.apache.blur.thrift.generated.Blur.Iface; +import org.apache.blur.thrift.generated.BlurException; +import org.apache.blur.thrift.generated.BlurQuery; +import org.apache.blur.thrift.generated.BlurResults; +import org.apache.blur.thrift.generated.SimpleQuery; +import org.apache.thrift.TException; + +public class SimpleQueryExample { + + public static void main(String[] args) throws BlurException, TException, IOException { + String connectionStr = args[0]; + String tableName = args[1]; + String query = args[2]; + + Iface client = BlurClient.getClient(connectionStr); + + final BlurQuery blurQuery = new BlurQuery(); + SimpleQuery simpleQuery = new SimpleQuery(); + blurQuery.setSimpleQuery(simpleQuery); + simpleQuery.setQueryStr(query); + BlurResults results = client.query(tableName, blurQuery); + System.out.println("Total Results: " + results.totalResults); + } +}
