Updated Branches: refs/heads/apache-blur-0.2 d2935accc -> ccdd40fcd
Adding rowId to blurquery as optional attribute for record queries. Project: http://git-wip-us.apache.org/repos/asf/incubator-blur/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-blur/commit/ccdd40fc Tree: http://git-wip-us.apache.org/repos/asf/incubator-blur/tree/ccdd40fc Diff: http://git-wip-us.apache.org/repos/asf/incubator-blur/diff/ccdd40fc Branch: refs/heads/apache-blur-0.2 Commit: ccdd40fcd70e63fe6734a1a1fca7565edd604d53 Parents: d2935ac Author: Aaron McCurry <[email protected]> Authored: Wed Jan 29 14:14:50 2014 -0500 Committer: Aaron McCurry <[email protected]> Committed: Wed Jan 29 14:14:50 2014 -0500 ---------------------------------------------------------------------- .../apache/blur/manager/BlurQueryChecker.java | 13 +- .../org/apache/blur/manager/IndexManager.java | 18 +++ .../clusterstatus/ZookeeperClusterStatus.java | 39 +++--- .../MasterBasedDistributedLayoutFactory.java | 13 ++ .../results/BlurResultIterableClient.java | 2 +- .../blur/thrift/BlurControllerServer.java | 34 +++-- .../org/apache/blur/thrift/BlurClusterTest.java | 22 ++++ .../blur/lucene/search/IterablePaging.java | 8 +- .../apache/blur/thrift/generated/BlurQuery.java | 132 ++++++++++++++++++- .../src/main/scripts/interface/Blur.thrift | 10 +- .../main/scripts/interface/gen-html/Blur.html | 5 +- .../apache/blur/thrift/generated/BlurQuery.java | 132 ++++++++++++++++++- .../main/scripts/interface/gen-js/Blur_types.js | 16 +++ .../scripts/interface/gen-perl/Blur/Types.pm | 17 ++- .../main/scripts/interface/gen-rb/blur_types.rb | 6 +- docs/Blur.html | 5 +- 16 files changed, 424 insertions(+), 48 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/ccdd40fc/blur-core/src/main/java/org/apache/blur/manager/BlurQueryChecker.java ---------------------------------------------------------------------- diff --git a/blur-core/src/main/java/org/apache/blur/manager/BlurQueryChecker.java b/blur-core/src/main/java/org/apache/blur/manager/BlurQueryChecker.java index 23a232b..f2fbd0d 100644 --- a/blur-core/src/main/java/org/apache/blur/manager/BlurQueryChecker.java +++ b/blur-core/src/main/java/org/apache/blur/manager/BlurQueryChecker.java @@ -23,7 +23,10 @@ import static org.apache.blur.utils.BlurConstants.BLUR_QUERY_MAX_ROW_FETCH; import org.apache.blur.BlurConfiguration; import org.apache.blur.log.Log; import org.apache.blur.log.LogFactory; +import org.apache.blur.thrift.BException; +import org.apache.blur.thrift.generated.BlurException; import org.apache.blur.thrift.generated.BlurQuery; +import org.apache.blur.thrift.generated.Query; import org.apache.blur.thrift.generated.Selector; import org.apache.blur.utils.BlurConstants; @@ -58,8 +61,9 @@ public class BlurQueryChecker { * * @param blurQuery * the {@link BlurQuery} to validate. + * @throws BlurException */ - public void checkQuery(BlurQuery blurQuery) { + public void checkQuery(BlurQuery blurQuery) throws BlurException { if (blurQuery.selector != null) { if (blurQuery.selector.recordOnly) { if (blurQuery.fetch > _maxQueryRecordFetch) { @@ -86,6 +90,13 @@ public class BlurQueryChecker { blurQuery.fetch, blurQuery.minimumNumberOfResults); blurQuery.fetch = (int) blurQuery.minimumNumberOfResults; } + if (blurQuery.getRowId() != null) { + Query query = blurQuery.getQuery(); + if (query.isRowQuery()) { + throw new BException("Query [{0}] in BlurQuery [{1}] cannot be a rowquery when rowId is supplied.", query, + blurQuery); + } + } } } http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/ccdd40fc/blur-core/src/main/java/org/apache/blur/manager/IndexManager.java ---------------------------------------------------------------------- diff --git a/blur-core/src/main/java/org/apache/blur/manager/IndexManager.java b/blur-core/src/main/java/org/apache/blur/manager/IndexManager.java index dc9499c..093cd81 100644 --- a/blur-core/src/main/java/org/apache/blur/manager/IndexManager.java +++ b/blur-core/src/main/java/org/apache/blur/manager/IndexManager.java @@ -458,6 +458,15 @@ public class IndexManager { LOG.error("Unknown error while trying to fetch index readers.", e); throw new BException(e.getMessage(), e); } + String rowId = blurQuery.getRowId(); + if (rowId != null) { + // reduce the index selection down to the only one that would contain the row. + Map<String, BlurIndex> map = new HashMap<String, BlurIndex>(); + String shard = MutationHelper.getShardName(table, rowId, getNumberOfShards(table), _blurPartitioner); + BlurIndex index = getBlurIndex(table, shard); + map.put(shard, index); + blurIndexes = map; + } Tracer trace = Trace.trace("query setup", Trace.param("table", table)); ShardServerContext shardServerContext = ShardServerContext.getShardServerContext(); ParallelCall<Entry<String, BlurIndex>, BlurResultIterable> call; @@ -466,6 +475,13 @@ public class IndexManager { org.apache.blur.thrift.generated.Query simpleQuery = blurQuery.query; ReadInterceptor interceptor = context.getReadInterceptor(); Filter readFilter = interceptor.getFilter(); + if (rowId != null) { + if (simpleQuery.recordFilter == null) { + simpleQuery.recordFilter = "+" + BlurConstants.ROW_ID + ":" + rowId; + } else { + simpleQuery.recordFilter = "+" + BlurConstants.ROW_ID + ":" + rowId + " +(" + simpleQuery.recordFilter + ")"; + } + } Filter recordFilterForSearch = QueryParserUtil.parseFilter(table, simpleQuery.recordFilter, false, fieldManager, _filterCache, context); Filter rowFilterForSearch = QueryParserUtil.parseFilter(table, simpleQuery.rowFilter, true, fieldManager, @@ -476,6 +492,8 @@ public class IndexManager { } else if (recordFilterForSearch != null && readFilter == null) { docFilter = recordFilterForSearch; } else if (recordFilterForSearch != null && readFilter != null) { + // @TODO dangerous call because of the bitsets that booleanfilter + // creates. BooleanFilter booleanFilter = new BooleanFilter(); booleanFilter.add(recordFilterForSearch, Occur.MUST); booleanFilter.add(readFilter, Occur.MUST); http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/ccdd40fc/blur-core/src/main/java/org/apache/blur/manager/clusterstatus/ZookeeperClusterStatus.java ---------------------------------------------------------------------- diff --git a/blur-core/src/main/java/org/apache/blur/manager/clusterstatus/ZookeeperClusterStatus.java b/blur-core/src/main/java/org/apache/blur/manager/clusterstatus/ZookeeperClusterStatus.java index d2deb10..55b26ff 100644 --- a/blur-core/src/main/java/org/apache/blur/manager/clusterstatus/ZookeeperClusterStatus.java +++ b/blur-core/src/main/java/org/apache/blur/manager/clusterstatus/ZookeeperClusterStatus.java @@ -36,6 +36,7 @@ import org.apache.blur.BlurConfiguration; import org.apache.blur.log.Log; import org.apache.blur.log.LogFactory; import org.apache.blur.lucene.search.FairSimilarity; +import org.apache.blur.manager.indexserver.MasterBasedDistributedLayoutFactory; import org.apache.blur.thirdparty.thrift_0_9_0.TDeserializer; import org.apache.blur.thirdparty.thrift_0_9_0.TException; import org.apache.blur.thirdparty.thrift_0_9_0.TSerializer; @@ -177,7 +178,7 @@ public class ZookeeperClusterStatus extends ClusterStatus { final String clusterTableKey = getClusterTableKey(cluster, table); WatchNodeExistance watchNodeExistance = _enabledWatchNodeExistance.remove(clusterTableKey); if (watchNodeExistance != null) { - watchNodeExistance.close(); + watchNodeExistance.close(); } _tableDescriptorCache.remove(table); } @@ -412,30 +413,30 @@ public class ZookeeperClusterStatus extends ClusterStatus { TableDescriptor tableDescriptor = new TableDescriptor(); try { checkIfOpen(); - + String blurTablePath = ZookeeperPathConstants.getTablePath(cluster, table); byte[] bytes = getData(blurTablePath); - + if (bytes == null || bytes.length == 0) { /* * table descriptor is stored in an older format where we manually - * serialized each field into a different zookeeper node - * so we fetch it using old code and serialize it again with thrift protocol + * serialized each field into a different zookeeper node so we fetch it + * using old code and serialize it again with thrift protocol */ LOG.info("The schema of Table [{0}] was stored in an older format. Now converting it to the new format", table); getOldTableDescriptor(useCache, cluster, table, tableDescriptor); - + BlurUtil.removeAll(_zk, blurTablePath); - + // store it using thrift protocol byte[] newFormatBytes = serializeTableDescriptor(tableDescriptor); BlurUtil.createPath(_zk, blurTablePath, newFormatBytes); - + } else { TDeserializer deserializer = new TDeserializer(new TJSONProtocol.Factory()); deserializer.deserialize(tableDescriptor, bytes); } - } catch (TException e) { + } catch (TException e) { throw new RuntimeException(e); } catch (KeeperException e) { throw new RuntimeException(e); @@ -450,10 +451,11 @@ public class ZookeeperClusterStatus extends ClusterStatus { return tableDescriptor; } - private TableDescriptor getOldTableDescriptor(boolean useCache, String cluster, String table, TableDescriptor tableDescriptor) { + private TableDescriptor getOldTableDescriptor(boolean useCache, String cluster, String table, + TableDescriptor tableDescriptor) { long s = System.nanoTime(); try { - + NullPointerException npe = null; LOOP: for (int i = 0; i < 10; i++) { npe = null; @@ -490,10 +492,10 @@ public class ZookeeperClusterStatus extends ClusterStatus { long e = System.nanoTime(); LOG.debug("trace getOldTableDescriptor took [" + (e - s) / 1000000.0 + " ms]"); } - + return tableDescriptor; } - + private boolean internalGetReadOnly(String tableReadOnlyPath) throws KeeperException, InterruptedException { Stat stat = _zk.exists(tableReadOnlyPath, false); if (stat == null) { @@ -730,7 +732,7 @@ public class ZookeeperClusterStatus extends ClusterStatus { throw new IOException("Table [" + table + "] already exists."); } BlurUtil.setupFileSystem(uri, shardCount); - byte[] bytes = serializeTableDescriptor(tableDescriptor); + byte[] bytes = serializeTableDescriptor(tableDescriptor); BlurUtil.createPath(_zk, blurTablePath, bytes); } catch (IOException e) { throw new RuntimeException(e); @@ -745,14 +747,14 @@ public class ZookeeperClusterStatus extends ClusterStatus { } private byte[] serializeTableDescriptor(TableDescriptor td) { - try{ + try { TSerializer serializer = new TSerializer(new TJSONProtocol.Factory()); return serializer.serialize(td); } catch (TException e) { throw new RuntimeException(e); } } - + private void assignTableUri(TableDescriptor tableDescriptor) { if (tableDescriptor.getTableUri() != null) { return; @@ -828,14 +830,17 @@ public class ZookeeperClusterStatus extends ClusterStatus { if (_zk.exists(blurTablePath, false) == null) { throw new IOException("Table [" + table + "] does not exist."); } - if (_zk.exists(ZookeeperPathConstants.getTableEnabledPath(cluster, table), false) != null) { + if (tableDescriptor.isEnabled()) { throw new IOException("Table [" + table + "] must be disabled before it can be removed."); } String uri = tableDescriptor.getTableUri(); BlurUtil.removeAll(_zk, blurTablePath); + MasterBasedDistributedLayoutFactory.removeTable(_zk, + ZookeeperPathConstants.getShardLayoutPathTableLayout(cluster), table); if (deleteIndexFiles) { BlurUtil.removeIndexFiles(uri); } + } catch (IOException e) { throw new RuntimeException(e); } catch (InterruptedException e) { http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/ccdd40fc/blur-core/src/main/java/org/apache/blur/manager/indexserver/MasterBasedDistributedLayoutFactory.java ---------------------------------------------------------------------- diff --git a/blur-core/src/main/java/org/apache/blur/manager/indexserver/MasterBasedDistributedLayoutFactory.java b/blur-core/src/main/java/org/apache/blur/manager/indexserver/MasterBasedDistributedLayoutFactory.java index eaa64c3..b9528b9 100644 --- a/blur-core/src/main/java/org/apache/blur/manager/indexserver/MasterBasedDistributedLayoutFactory.java +++ b/blur-core/src/main/java/org/apache/blur/manager/indexserver/MasterBasedDistributedLayoutFactory.java @@ -175,6 +175,19 @@ public class MasterBasedDistributedLayoutFactory implements DistributedLayoutFac } } + public static void removeTable(ZooKeeper zooKeeper, String tableStoragePath, String table) throws InterruptedException, KeeperException { + List<String> children = new ArrayList<String>(zooKeeper.getChildren(tableStoragePath, false)); + for (String child : children) { + int index = child.lastIndexOf(SEP); + if (index >= 0) { + if (child.substring(0, index).equals(table)) { + String oldPath = tableStoragePath + "/" + child; + zooKeeper.delete(oldPath, -1); + } + } + } + } + private void cleanupOldTableLayouts(String table, String newPath) throws KeeperException, InterruptedException { List<String> children = new ArrayList<String>(_zooKeeper.getChildren(_tableStoragePath, false)); for (String child : children) { http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/ccdd40fc/blur-core/src/main/java/org/apache/blur/manager/results/BlurResultIterableClient.java ---------------------------------------------------------------------- diff --git a/blur-core/src/main/java/org/apache/blur/manager/results/BlurResultIterableClient.java b/blur-core/src/main/java/org/apache/blur/manager/results/BlurResultIterableClient.java index 14cbf50..fdda6e3 100644 --- a/blur-core/src/main/java/org/apache/blur/manager/results/BlurResultIterableClient.java +++ b/blur-core/src/main/java/org/apache/blur/manager/results/BlurResultIterableClient.java @@ -73,7 +73,7 @@ public class BlurResultIterableClient implements BlurResultIterable { BlurQuery blurQuery = new BlurQuery(_originalQuery.query, _originalQuery.facets, null, _originalQuery.useCacheIfPresent, cursor, _remoteFetchCount, _originalQuery.minimumNumberOfResults, _originalQuery.maxQueryTime, _originalQuery.uuid, _originalQuery.userContext, _originalQuery.cacheResult, - _originalQuery.startTime, _originalQuery.getSortFields()); + _originalQuery.startTime, _originalQuery.getSortFields(), _originalQuery.getRowId()); _results = makeLazy(_client.query(_table, blurQuery)); addFacets(); _totalResults = _results.totalResults; http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/ccdd40fc/blur-core/src/main/java/org/apache/blur/thrift/BlurControllerServer.java ---------------------------------------------------------------------- diff --git a/blur-core/src/main/java/org/apache/blur/thrift/BlurControllerServer.java b/blur-core/src/main/java/org/apache/blur/thrift/BlurControllerServer.java index f529b0a..5766ad6 100644 --- a/blur-core/src/main/java/org/apache/blur/thrift/BlurControllerServer.java +++ b/blur-core/src/main/java/org/apache/blur/thrift/BlurControllerServer.java @@ -448,11 +448,17 @@ public class BlurControllerServer extends TableAdmin implements Iface { MergerBlurResultIterable merger = new MergerBlurResultIterable(blurQuery); BlurResultIterable hitsIterable = null; try { - Tracer scatterGatherTrace = Trace.trace("query - satterGather", Trace.param("retries", retries)); - try { - hitsIterable = scatterGather(getCluster(table), command, merger); - } finally { - scatterGatherTrace.done(); + String rowId = blurQuery.getRowId(); + if (rowId == null) { + Tracer scatterGatherTrace = Trace.trace("query - scatterGather", Trace.param("retries", retries)); + try { + hitsIterable = scatterGather(tableDescriptor.getCluster(), command, merger); + } finally { + scatterGatherTrace.done(); + } + } else { + String clientHostnamePort = getNode(table, rowId); + hitsIterable = _client.execute(clientHostnamePort, command, _maxFetchRetries, _fetchDelay, _maxFetchDelay); } BlurResults results; Tracer convertToBlurResults = Trace.trace("query - convertToBlurResults", Trace.param("retries", retries)); @@ -606,9 +612,14 @@ public class BlurControllerServer extends TableAdmin implements Iface { if (results.totalResults >= query.minimumNumberOfResults) { return true; } - int shardInfoSize = results.getShardInfoSize(); - if (shardInfoSize == shardCount) { - return true; + if (query.getRowId() == null) { + if (results.getShardInfoSize() == shardCount) { + return true; + } + } else { + if (results.getShardInfoSize() == 1) { + return true; + } } return false; } @@ -935,6 +946,13 @@ public class BlurControllerServer extends TableAdmin implements Iface { } } + private String getNode(String table, String rowId) throws BlurException, TException { + Map<String, String> layout = shardServerLayout(table); + int numberOfShards = getShardCount(table); + String shardName = MutationHelper.getShardName(table, rowId, numberOfShards, _blurPartitioner); + return layout.get(shardName); + } + private String getNode(String table, Selector selector) throws BlurException, TException { Map<String, String> layout = shardServerLayout(table); String locationId = selector.locationId; http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/ccdd40fc/blur-core/src/test/java/org/apache/blur/thrift/BlurClusterTest.java ---------------------------------------------------------------------- diff --git a/blur-core/src/test/java/org/apache/blur/thrift/BlurClusterTest.java b/blur-core/src/test/java/org/apache/blur/thrift/BlurClusterTest.java index 348708a..a3a6cf1 100644 --- a/blur-core/src/test/java/org/apache/blur/thrift/BlurClusterTest.java +++ b/blur-core/src/test/java/org/apache/blur/thrift/BlurClusterTest.java @@ -123,6 +123,8 @@ public class BlurClusterTest { testCreateTable(); start("testLoadTable"); testLoadTable(); + start("testBlurQueryWithRowId"); + testBlurQueryWithRowId(); start("testForEmptySchema"); testForEmptySchema(); start("testAdminCalls"); @@ -147,6 +149,26 @@ public class BlurClusterTest { testCreateTableWithCustomType(); } + private void testBlurQueryWithRowId() throws BlurException, TException { + Blur.Iface client = getClient(); + BlurQuery blurQuery = new BlurQuery(); + Query query = new Query(); + query.setQuery("*"); + blurQuery.setQuery(query); + BlurResults results1 = client.query("test", blurQuery); + assertEquals(numberOfDocs, results1.getTotalResults()); + String id1 = results1.getResults().iterator().next().getFetchResult().getRowResult().getRow().getId(); + + blurQuery.setRowId(id1); + + query.setRowQuery(false); + BlurResults results2 = client.query("test", blurQuery); + assertEquals(1, results2.getTotalResults()); + String id2 = results2.getResults().iterator().next().getFetchResult().getRecordResult().getRowid(); + + assertEquals(id1, id2); + } + private void testAdminCalls() throws BlurException, TException { Blur.Iface client = getClient(); List<String> shardClusterList = client.shardClusterList(); http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/ccdd40fc/blur-query/src/main/java/org/apache/blur/lucene/search/IterablePaging.java ---------------------------------------------------------------------- diff --git a/blur-query/src/main/java/org/apache/blur/lucene/search/IterablePaging.java b/blur-query/src/main/java/org/apache/blur/lucene/search/IterablePaging.java index b9502ed..3fd7d00 100644 --- a/blur-query/src/main/java/org/apache/blur/lucene/search/IterablePaging.java +++ b/blur-query/src/main/java/org/apache/blur/lucene/search/IterablePaging.java @@ -56,11 +56,6 @@ public class IterablePaging implements BlurIterable<ScoreDoc, BlurException> { private int skipTo; private int gather = -1; -// public IterablePaging(AtomicBoolean running, IndexSearcher searcher, Query query, int numHitsToCollect, -// TotalHitsRef totalHitsRef, ProgressRef progressRef, boolean runSlow) throws BlurException { -// this(running, searcher, query, numHitsToCollect, totalHitsRef, progressRef, runSlow, null); -// } - public IterablePaging(AtomicBoolean running, IndexSearcher searcher, Query query, int numHitsToCollect, TotalHitsRef totalHitsRef, ProgressRef progressRef, boolean runSlow, Sort sort) throws BlurException { _running = running; @@ -247,8 +242,7 @@ public class IterablePaging implements BlurIterable<ScoreDoc, BlurException> { } } - private BlurIterator<ScoreDoc, BlurException> skipHits(PagingIterator iterator) - throws BlurException { + private BlurIterator<ScoreDoc, BlurException> skipHits(PagingIterator iterator) throws BlurException { _progressRef.skipTo.set(skipTo); for (int i = 0; i < skipTo && iterator.hasNext(); i++) { // eats the hits, and moves the iterator to the desired skip to position. http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/ccdd40fc/blur-thrift/src/main/java/org/apache/blur/thrift/generated/BlurQuery.java ---------------------------------------------------------------------- diff --git a/blur-thrift/src/main/java/org/apache/blur/thrift/generated/BlurQuery.java b/blur-thrift/src/main/java/org/apache/blur/thrift/generated/BlurQuery.java index 9c6d71d..4bba3b8 100644 --- a/blur-thrift/src/main/java/org/apache/blur/thrift/generated/BlurQuery.java +++ b/blur-thrift/src/main/java/org/apache/blur/thrift/generated/BlurQuery.java @@ -69,6 +69,7 @@ public class BlurQuery implements org.apache.blur.thirdparty.thrift_0_9_0.TBase< private static final org.apache.blur.thirdparty.thrift_0_9_0.protocol.TField CACHE_RESULT_FIELD_DESC = new org.apache.blur.thirdparty.thrift_0_9_0.protocol.TField("cacheResult", org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.BOOL, (short)13); private static final org.apache.blur.thirdparty.thrift_0_9_0.protocol.TField START_TIME_FIELD_DESC = new org.apache.blur.thirdparty.thrift_0_9_0.protocol.TField("startTime", org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.I64, (short)14); private static final org.apache.blur.thirdparty.thrift_0_9_0.protocol.TField SORT_FIELDS_FIELD_DESC = new org.apache.blur.thirdparty.thrift_0_9_0.protocol.TField("sortFields", org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.LIST, (short)15); + private static final org.apache.blur.thirdparty.thrift_0_9_0.protocol.TField ROW_ID_FIELD_DESC = new org.apache.blur.thirdparty.thrift_0_9_0.protocol.TField("rowId", org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.STRING, (short)16); private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); static { @@ -126,7 +127,14 @@ public class BlurQuery implements org.apache.blur.thirdparty.thrift_0_9_0.TBase< * Sets the start time, if 0 the controller sets the time. */ public long startTime; // required + /** + * The sortfields are applied in order to sort the results. + */ public List<SortField> sortFields; // required + /** + * Optional optimization for record queries to run against a single row. This will allow the query to be executed on one and only one shard in the cluster. + */ + public String rowId; // required /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ public enum _Fields implements org.apache.blur.thirdparty.thrift_0_9_0.TFieldIdEnum { @@ -180,7 +188,14 @@ public class BlurQuery implements org.apache.blur.thirdparty.thrift_0_9_0.TBase< * Sets the start time, if 0 the controller sets the time. */ START_TIME((short)14, "startTime"), - SORT_FIELDS((short)15, "sortFields"); + /** + * The sortfields are applied in order to sort the results. + */ + SORT_FIELDS((short)15, "sortFields"), + /** + * Optional optimization for record queries to run against a single row. This will allow the query to be executed on one and only one shard in the cluster. + */ + ROW_ID((short)16, "rowId"); private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); @@ -221,6 +236,8 @@ public class BlurQuery implements org.apache.blur.thirdparty.thrift_0_9_0.TBase< return START_TIME; case 15: // SORT_FIELDS return SORT_FIELDS; + case 16: // ROW_ID + return ROW_ID; default: return null; } @@ -300,6 +317,8 @@ public class BlurQuery implements org.apache.blur.thirdparty.thrift_0_9_0.TBase< tmpMap.put(_Fields.SORT_FIELDS, new org.apache.blur.thirdparty.thrift_0_9_0.meta_data.FieldMetaData("sortFields", org.apache.blur.thirdparty.thrift_0_9_0.TFieldRequirementType.DEFAULT, new org.apache.blur.thirdparty.thrift_0_9_0.meta_data.ListMetaData(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.LIST, new org.apache.blur.thirdparty.thrift_0_9_0.meta_data.StructMetaData(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.STRUCT, SortField.class)))); + tmpMap.put(_Fields.ROW_ID, new org.apache.blur.thirdparty.thrift_0_9_0.meta_data.FieldMetaData("rowId", org.apache.blur.thirdparty.thrift_0_9_0.TFieldRequirementType.DEFAULT, + new org.apache.blur.thirdparty.thrift_0_9_0.meta_data.FieldValueMetaData(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.STRING))); metaDataMap = Collections.unmodifiableMap(tmpMap); org.apache.blur.thirdparty.thrift_0_9_0.meta_data.FieldMetaData.addStructMetaDataMap(BlurQuery.class, metaDataMap); } @@ -334,7 +353,8 @@ public class BlurQuery implements org.apache.blur.thirdparty.thrift_0_9_0.TBase< String userContext, boolean cacheResult, long startTime, - List<SortField> sortFields) + List<SortField> sortFields, + String rowId) { this(); this.query = query; @@ -357,6 +377,7 @@ public class BlurQuery implements org.apache.blur.thirdparty.thrift_0_9_0.TBase< this.startTime = startTime; setStartTimeIsSet(true); this.sortFields = sortFields; + this.rowId = rowId; } /** @@ -397,6 +418,9 @@ public class BlurQuery implements org.apache.blur.thirdparty.thrift_0_9_0.TBase< } this.sortFields = __this__sortFields; } + if (other.isSetRowId()) { + this.rowId = other.rowId; + } } public BlurQuery deepCopy() { @@ -425,6 +449,7 @@ public class BlurQuery implements org.apache.blur.thirdparty.thrift_0_9_0.TBase< this.startTime = 0L; this.sortFields = null; + this.rowId = null; } /** @@ -814,10 +839,16 @@ public class BlurQuery implements org.apache.blur.thirdparty.thrift_0_9_0.TBase< this.sortFields.add(elem); } + /** + * The sortfields are applied in order to sort the results. + */ public List<SortField> getSortFields() { return this.sortFields; } + /** + * The sortfields are applied in order to sort the results. + */ public BlurQuery setSortFields(List<SortField> sortFields) { this.sortFields = sortFields; return this; @@ -838,6 +869,36 @@ public class BlurQuery implements org.apache.blur.thirdparty.thrift_0_9_0.TBase< } } + /** + * Optional optimization for record queries to run against a single row. This will allow the query to be executed on one and only one shard in the cluster. + */ + public String getRowId() { + return this.rowId; + } + + /** + * Optional optimization for record queries to run against a single row. This will allow the query to be executed on one and only one shard in the cluster. + */ + public BlurQuery setRowId(String rowId) { + this.rowId = rowId; + return this; + } + + public void unsetRowId() { + this.rowId = null; + } + + /** Returns true if field rowId is set (has been assigned a value) and false otherwise */ + public boolean isSetRowId() { + return this.rowId != null; + } + + public void setRowIdIsSet(boolean value) { + if (!value) { + this.rowId = null; + } + } + public void setFieldValue(_Fields field, Object value) { switch (field) { case QUERY: @@ -944,6 +1005,14 @@ public class BlurQuery implements org.apache.blur.thirdparty.thrift_0_9_0.TBase< } break; + case ROW_ID: + if (value == null) { + unsetRowId(); + } else { + setRowId((String)value); + } + break; + } } @@ -988,6 +1057,9 @@ public class BlurQuery implements org.apache.blur.thirdparty.thrift_0_9_0.TBase< case SORT_FIELDS: return getSortFields(); + case ROW_ID: + return getRowId(); + } throw new IllegalStateException(); } @@ -1025,6 +1097,8 @@ public class BlurQuery implements org.apache.blur.thirdparty.thrift_0_9_0.TBase< return isSetStartTime(); case SORT_FIELDS: return isSetSortFields(); + case ROW_ID: + return isSetRowId(); } throw new IllegalStateException(); } @@ -1159,6 +1233,15 @@ public class BlurQuery implements org.apache.blur.thirdparty.thrift_0_9_0.TBase< return false; } + boolean this_present_rowId = true && this.isSetRowId(); + boolean that_present_rowId = true && that.isSetRowId(); + if (this_present_rowId || that_present_rowId) { + if (!(this_present_rowId && that_present_rowId)) + return false; + if (!this.rowId.equals(that.rowId)) + return false; + } + return true; } @@ -1305,6 +1388,16 @@ public class BlurQuery implements org.apache.blur.thirdparty.thrift_0_9_0.TBase< return lastComparison; } } + lastComparison = Boolean.valueOf(isSetRowId()).compareTo(typedOther.isSetRowId()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetRowId()) { + lastComparison = org.apache.blur.thirdparty.thrift_0_9_0.TBaseHelper.compareTo(this.rowId, typedOther.rowId); + if (lastComparison != 0) { + return lastComparison; + } + } return 0; } @@ -1400,6 +1493,14 @@ public class BlurQuery implements org.apache.blur.thirdparty.thrift_0_9_0.TBase< sb.append(this.sortFields); } first = false; + if (!first) sb.append(", "); + sb.append("rowId:"); + if (this.rowId == null) { + sb.append("null"); + } else { + sb.append(this.rowId); + } + first = false; sb.append(")"); return sb.toString(); } @@ -1579,6 +1680,14 @@ public class BlurQuery implements org.apache.blur.thirdparty.thrift_0_9_0.TBase< org.apache.blur.thirdparty.thrift_0_9_0.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; + case 16: // ROW_ID + if (schemeField.type == org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.STRING) { + struct.rowId = iprot.readString(); + struct.setRowIdIsSet(true); + } else { + org.apache.blur.thirdparty.thrift_0_9_0.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; default: org.apache.blur.thirdparty.thrift_0_9_0.protocol.TProtocolUtil.skip(iprot, schemeField.type); } @@ -1659,6 +1768,11 @@ public class BlurQuery implements org.apache.blur.thirdparty.thrift_0_9_0.TBase< } oprot.writeFieldEnd(); } + if (struct.rowId != null) { + oprot.writeFieldBegin(ROW_ID_FIELD_DESC); + oprot.writeString(struct.rowId); + oprot.writeFieldEnd(); + } oprot.writeFieldStop(); oprot.writeStructEnd(); } @@ -1716,7 +1830,10 @@ public class BlurQuery implements org.apache.blur.thirdparty.thrift_0_9_0.TBase< if (struct.isSetSortFields()) { optionals.set(12); } - oprot.writeBitSet(optionals, 13); + if (struct.isSetRowId()) { + optionals.set(13); + } + oprot.writeBitSet(optionals, 14); if (struct.isSetQuery()) { struct.query.write(oprot); } @@ -1768,12 +1885,15 @@ public class BlurQuery implements org.apache.blur.thirdparty.thrift_0_9_0.TBase< } } } + if (struct.isSetRowId()) { + oprot.writeString(struct.rowId); + } } @Override public void read(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TProtocol prot, BlurQuery struct) throws org.apache.blur.thirdparty.thrift_0_9_0.TException { TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(13); + BitSet incoming = iprot.readBitSet(14); if (incoming.get(0)) { struct.query = new Query(); struct.query.read(iprot); @@ -1848,6 +1968,10 @@ public class BlurQuery implements org.apache.blur.thirdparty.thrift_0_9_0.TBase< } struct.setSortFieldsIsSet(true); } + if (incoming.get(13)) { + struct.rowId = iprot.readString(); + struct.setRowIdIsSet(true); + } } } http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/ccdd40fc/distribution/src/main/scripts/interface/Blur.thrift ---------------------------------------------------------------------- diff --git a/distribution/src/main/scripts/interface/Blur.thrift b/distribution/src/main/scripts/interface/Blur.thrift index d4b1e3d..bc92034 100644 --- a/distribution/src/main/scripts/interface/Blur.thrift +++ b/distribution/src/main/scripts/interface/Blur.thrift @@ -456,8 +456,14 @@ struct BlurQuery { * Sets the start time, if 0 the controller sets the time. */ 14:i64 startTime = 0, - - 15:list<SortField> sortFields + /** + * The sortfields are applied in order to sort the results. + */ + 15:list<SortField> sortFields, + /** + * Optional optimization for record queries to run against a single row. This will allow the query to be executed on one and only one shard in the cluster. + */ + 16:string rowId } /** http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/ccdd40fc/distribution/src/main/scripts/interface/gen-html/Blur.html ---------------------------------------------------------------------- diff --git a/distribution/src/main/scripts/interface/gen-html/Blur.html b/distribution/src/main/scripts/interface/gen-html/Blur.html index fc49117..27248cf 100644 --- a/distribution/src/main/scripts/interface/gen-html/Blur.html +++ b/distribution/src/main/scripts/interface/gen-html/Blur.html @@ -360,7 +360,10 @@ of a running query can be found or the query can be canceled. </td><td>default</td><td>1</td></tr> <tr><td>14</td><td>startTime</td><td><code>i64</code></td><td>Sets the start time, if 0 the controller sets the time. </td><td>default</td><td>0</td></tr> -<tr><td>15</td><td>sortFields</td><td><code>list<<code><a href="Blur.html#Struct_SortField">SortField</a></code>></code></td><td></td><td>default</td><td></td></tr> +<tr><td>15</td><td>sortFields</td><td><code>list<<code><a href="Blur.html#Struct_SortField">SortField</a></code>></code></td><td>The sortfields are applied in order to sort the results. +</td><td>default</td><td></td></tr> +<tr><td>16</td><td>rowId</td><td><code>string</code></td><td>Optional optimization for record queries to run against a single row. This will allow the query to be executed on one and only one shard in the cluster. +</td><td>default</td><td></td></tr> </table><br/>The Blur Query object that contains the query that needs to be executed along with the query options. <br/></div><div class="definition"><h3 id="Struct_SortFieldResult">Struct: SortFieldResult</h3> http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/ccdd40fc/distribution/src/main/scripts/interface/gen-java/org/apache/blur/thrift/generated/BlurQuery.java ---------------------------------------------------------------------- diff --git a/distribution/src/main/scripts/interface/gen-java/org/apache/blur/thrift/generated/BlurQuery.java b/distribution/src/main/scripts/interface/gen-java/org/apache/blur/thrift/generated/BlurQuery.java index 9c6d71d..4bba3b8 100644 --- a/distribution/src/main/scripts/interface/gen-java/org/apache/blur/thrift/generated/BlurQuery.java +++ b/distribution/src/main/scripts/interface/gen-java/org/apache/blur/thrift/generated/BlurQuery.java @@ -69,6 +69,7 @@ public class BlurQuery implements org.apache.blur.thirdparty.thrift_0_9_0.TBase< private static final org.apache.blur.thirdparty.thrift_0_9_0.protocol.TField CACHE_RESULT_FIELD_DESC = new org.apache.blur.thirdparty.thrift_0_9_0.protocol.TField("cacheResult", org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.BOOL, (short)13); private static final org.apache.blur.thirdparty.thrift_0_9_0.protocol.TField START_TIME_FIELD_DESC = new org.apache.blur.thirdparty.thrift_0_9_0.protocol.TField("startTime", org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.I64, (short)14); private static final org.apache.blur.thirdparty.thrift_0_9_0.protocol.TField SORT_FIELDS_FIELD_DESC = new org.apache.blur.thirdparty.thrift_0_9_0.protocol.TField("sortFields", org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.LIST, (short)15); + private static final org.apache.blur.thirdparty.thrift_0_9_0.protocol.TField ROW_ID_FIELD_DESC = new org.apache.blur.thirdparty.thrift_0_9_0.protocol.TField("rowId", org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.STRING, (short)16); private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); static { @@ -126,7 +127,14 @@ public class BlurQuery implements org.apache.blur.thirdparty.thrift_0_9_0.TBase< * Sets the start time, if 0 the controller sets the time. */ public long startTime; // required + /** + * The sortfields are applied in order to sort the results. + */ public List<SortField> sortFields; // required + /** + * Optional optimization for record queries to run against a single row. This will allow the query to be executed on one and only one shard in the cluster. + */ + public String rowId; // required /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ public enum _Fields implements org.apache.blur.thirdparty.thrift_0_9_0.TFieldIdEnum { @@ -180,7 +188,14 @@ public class BlurQuery implements org.apache.blur.thirdparty.thrift_0_9_0.TBase< * Sets the start time, if 0 the controller sets the time. */ START_TIME((short)14, "startTime"), - SORT_FIELDS((short)15, "sortFields"); + /** + * The sortfields are applied in order to sort the results. + */ + SORT_FIELDS((short)15, "sortFields"), + /** + * Optional optimization for record queries to run against a single row. This will allow the query to be executed on one and only one shard in the cluster. + */ + ROW_ID((short)16, "rowId"); private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); @@ -221,6 +236,8 @@ public class BlurQuery implements org.apache.blur.thirdparty.thrift_0_9_0.TBase< return START_TIME; case 15: // SORT_FIELDS return SORT_FIELDS; + case 16: // ROW_ID + return ROW_ID; default: return null; } @@ -300,6 +317,8 @@ public class BlurQuery implements org.apache.blur.thirdparty.thrift_0_9_0.TBase< tmpMap.put(_Fields.SORT_FIELDS, new org.apache.blur.thirdparty.thrift_0_9_0.meta_data.FieldMetaData("sortFields", org.apache.blur.thirdparty.thrift_0_9_0.TFieldRequirementType.DEFAULT, new org.apache.blur.thirdparty.thrift_0_9_0.meta_data.ListMetaData(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.LIST, new org.apache.blur.thirdparty.thrift_0_9_0.meta_data.StructMetaData(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.STRUCT, SortField.class)))); + tmpMap.put(_Fields.ROW_ID, new org.apache.blur.thirdparty.thrift_0_9_0.meta_data.FieldMetaData("rowId", org.apache.blur.thirdparty.thrift_0_9_0.TFieldRequirementType.DEFAULT, + new org.apache.blur.thirdparty.thrift_0_9_0.meta_data.FieldValueMetaData(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.STRING))); metaDataMap = Collections.unmodifiableMap(tmpMap); org.apache.blur.thirdparty.thrift_0_9_0.meta_data.FieldMetaData.addStructMetaDataMap(BlurQuery.class, metaDataMap); } @@ -334,7 +353,8 @@ public class BlurQuery implements org.apache.blur.thirdparty.thrift_0_9_0.TBase< String userContext, boolean cacheResult, long startTime, - List<SortField> sortFields) + List<SortField> sortFields, + String rowId) { this(); this.query = query; @@ -357,6 +377,7 @@ public class BlurQuery implements org.apache.blur.thirdparty.thrift_0_9_0.TBase< this.startTime = startTime; setStartTimeIsSet(true); this.sortFields = sortFields; + this.rowId = rowId; } /** @@ -397,6 +418,9 @@ public class BlurQuery implements org.apache.blur.thirdparty.thrift_0_9_0.TBase< } this.sortFields = __this__sortFields; } + if (other.isSetRowId()) { + this.rowId = other.rowId; + } } public BlurQuery deepCopy() { @@ -425,6 +449,7 @@ public class BlurQuery implements org.apache.blur.thirdparty.thrift_0_9_0.TBase< this.startTime = 0L; this.sortFields = null; + this.rowId = null; } /** @@ -814,10 +839,16 @@ public class BlurQuery implements org.apache.blur.thirdparty.thrift_0_9_0.TBase< this.sortFields.add(elem); } + /** + * The sortfields are applied in order to sort the results. + */ public List<SortField> getSortFields() { return this.sortFields; } + /** + * The sortfields are applied in order to sort the results. + */ public BlurQuery setSortFields(List<SortField> sortFields) { this.sortFields = sortFields; return this; @@ -838,6 +869,36 @@ public class BlurQuery implements org.apache.blur.thirdparty.thrift_0_9_0.TBase< } } + /** + * Optional optimization for record queries to run against a single row. This will allow the query to be executed on one and only one shard in the cluster. + */ + public String getRowId() { + return this.rowId; + } + + /** + * Optional optimization for record queries to run against a single row. This will allow the query to be executed on one and only one shard in the cluster. + */ + public BlurQuery setRowId(String rowId) { + this.rowId = rowId; + return this; + } + + public void unsetRowId() { + this.rowId = null; + } + + /** Returns true if field rowId is set (has been assigned a value) and false otherwise */ + public boolean isSetRowId() { + return this.rowId != null; + } + + public void setRowIdIsSet(boolean value) { + if (!value) { + this.rowId = null; + } + } + public void setFieldValue(_Fields field, Object value) { switch (field) { case QUERY: @@ -944,6 +1005,14 @@ public class BlurQuery implements org.apache.blur.thirdparty.thrift_0_9_0.TBase< } break; + case ROW_ID: + if (value == null) { + unsetRowId(); + } else { + setRowId((String)value); + } + break; + } } @@ -988,6 +1057,9 @@ public class BlurQuery implements org.apache.blur.thirdparty.thrift_0_9_0.TBase< case SORT_FIELDS: return getSortFields(); + case ROW_ID: + return getRowId(); + } throw new IllegalStateException(); } @@ -1025,6 +1097,8 @@ public class BlurQuery implements org.apache.blur.thirdparty.thrift_0_9_0.TBase< return isSetStartTime(); case SORT_FIELDS: return isSetSortFields(); + case ROW_ID: + return isSetRowId(); } throw new IllegalStateException(); } @@ -1159,6 +1233,15 @@ public class BlurQuery implements org.apache.blur.thirdparty.thrift_0_9_0.TBase< return false; } + boolean this_present_rowId = true && this.isSetRowId(); + boolean that_present_rowId = true && that.isSetRowId(); + if (this_present_rowId || that_present_rowId) { + if (!(this_present_rowId && that_present_rowId)) + return false; + if (!this.rowId.equals(that.rowId)) + return false; + } + return true; } @@ -1305,6 +1388,16 @@ public class BlurQuery implements org.apache.blur.thirdparty.thrift_0_9_0.TBase< return lastComparison; } } + lastComparison = Boolean.valueOf(isSetRowId()).compareTo(typedOther.isSetRowId()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetRowId()) { + lastComparison = org.apache.blur.thirdparty.thrift_0_9_0.TBaseHelper.compareTo(this.rowId, typedOther.rowId); + if (lastComparison != 0) { + return lastComparison; + } + } return 0; } @@ -1400,6 +1493,14 @@ public class BlurQuery implements org.apache.blur.thirdparty.thrift_0_9_0.TBase< sb.append(this.sortFields); } first = false; + if (!first) sb.append(", "); + sb.append("rowId:"); + if (this.rowId == null) { + sb.append("null"); + } else { + sb.append(this.rowId); + } + first = false; sb.append(")"); return sb.toString(); } @@ -1579,6 +1680,14 @@ public class BlurQuery implements org.apache.blur.thirdparty.thrift_0_9_0.TBase< org.apache.blur.thirdparty.thrift_0_9_0.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; + case 16: // ROW_ID + if (schemeField.type == org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.STRING) { + struct.rowId = iprot.readString(); + struct.setRowIdIsSet(true); + } else { + org.apache.blur.thirdparty.thrift_0_9_0.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; default: org.apache.blur.thirdparty.thrift_0_9_0.protocol.TProtocolUtil.skip(iprot, schemeField.type); } @@ -1659,6 +1768,11 @@ public class BlurQuery implements org.apache.blur.thirdparty.thrift_0_9_0.TBase< } oprot.writeFieldEnd(); } + if (struct.rowId != null) { + oprot.writeFieldBegin(ROW_ID_FIELD_DESC); + oprot.writeString(struct.rowId); + oprot.writeFieldEnd(); + } oprot.writeFieldStop(); oprot.writeStructEnd(); } @@ -1716,7 +1830,10 @@ public class BlurQuery implements org.apache.blur.thirdparty.thrift_0_9_0.TBase< if (struct.isSetSortFields()) { optionals.set(12); } - oprot.writeBitSet(optionals, 13); + if (struct.isSetRowId()) { + optionals.set(13); + } + oprot.writeBitSet(optionals, 14); if (struct.isSetQuery()) { struct.query.write(oprot); } @@ -1768,12 +1885,15 @@ public class BlurQuery implements org.apache.blur.thirdparty.thrift_0_9_0.TBase< } } } + if (struct.isSetRowId()) { + oprot.writeString(struct.rowId); + } } @Override public void read(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TProtocol prot, BlurQuery struct) throws org.apache.blur.thirdparty.thrift_0_9_0.TException { TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(13); + BitSet incoming = iprot.readBitSet(14); if (incoming.get(0)) { struct.query = new Query(); struct.query.read(iprot); @@ -1848,6 +1968,10 @@ public class BlurQuery implements org.apache.blur.thirdparty.thrift_0_9_0.TBase< } struct.setSortFieldsIsSet(true); } + if (incoming.get(13)) { + struct.rowId = iprot.readString(); + struct.setRowIdIsSet(true); + } } } http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/ccdd40fc/distribution/src/main/scripts/interface/gen-js/Blur_types.js ---------------------------------------------------------------------- diff --git a/distribution/src/main/scripts/interface/gen-js/Blur_types.js b/distribution/src/main/scripts/interface/gen-js/Blur_types.js index fffd9c8..5c0a534 100644 --- a/distribution/src/main/scripts/interface/gen-js/Blur_types.js +++ b/distribution/src/main/scripts/interface/gen-js/Blur_types.js @@ -1339,6 +1339,7 @@ BlurQuery = function(args) { this.cacheResult = true; this.startTime = 0; this.sortFields = null; + this.rowId = null; if (args) { if (args.query !== undefined) { this.query = args.query; @@ -1379,6 +1380,9 @@ BlurQuery = function(args) { if (args.sortFields !== undefined) { this.sortFields = args.sortFields; } + if (args.rowId !== undefined) { + this.rowId = args.rowId; + } } }; BlurQuery.prototype = {}; @@ -1516,6 +1520,13 @@ BlurQuery.prototype.read = function(input) { input.skip(ftype); } break; + case 16: + if (ftype == Thrift.Type.STRING) { + this.rowId = input.readString().value; + } else { + input.skip(ftype); + } + break; default: input.skip(ftype); } @@ -1610,6 +1621,11 @@ BlurQuery.prototype.write = function(output) { output.writeListEnd(); output.writeFieldEnd(); } + if (this.rowId !== null && this.rowId !== undefined) { + output.writeFieldBegin('rowId', Thrift.Type.STRING, 16); + output.writeString(this.rowId); + output.writeFieldEnd(); + } output.writeFieldStop(); output.writeStructEnd(); return; http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/ccdd40fc/distribution/src/main/scripts/interface/gen-perl/Blur/Types.pm ---------------------------------------------------------------------- diff --git a/distribution/src/main/scripts/interface/gen-perl/Blur/Types.pm b/distribution/src/main/scripts/interface/gen-perl/Blur/Types.pm index 1a16302..b4f0ab0 100644 --- a/distribution/src/main/scripts/interface/gen-perl/Blur/Types.pm +++ b/distribution/src/main/scripts/interface/gen-perl/Blur/Types.pm @@ -1447,7 +1447,7 @@ sub write { package Blur::BlurQuery; use base qw(Class::Accessor); -Blur::BlurQuery->mk_accessors( qw( query facets selector useCacheIfPresent start fetch minimumNumberOfResults maxQueryTime uuid userContext cacheResult startTime sortFields ) ); +Blur::BlurQuery->mk_accessors( qw( query facets selector useCacheIfPresent start fetch minimumNumberOfResults maxQueryTime uuid userContext cacheResult startTime sortFields rowId ) ); sub new { my $classname = shift; @@ -1466,6 +1466,7 @@ sub new { $self->{cacheResult} = 1; $self->{startTime} = 0; $self->{sortFields} = undef; + $self->{rowId} = undef; if (UNIVERSAL::isa($vals,'HASH')) { if (defined $vals->{query}) { $self->{query} = $vals->{query}; @@ -1506,6 +1507,9 @@ sub new { if (defined $vals->{sortFields}) { $self->{sortFields} = $vals->{sortFields}; } + if (defined $vals->{rowId}) { + $self->{rowId} = $vals->{rowId}; + } } return bless ($self, $classname); } @@ -1635,6 +1639,12 @@ sub read { $xfer += $input->skip($ftype); } last; }; + /^16$/ && do{ if ($ftype == TType::STRING) { + $xfer += $input->readString(\$self->{rowId}); + } else { + $xfer += $input->skip($ftype); + } + last; }; $xfer += $input->skip($ftype); } $xfer += $input->readFieldEnd(); @@ -1730,6 +1740,11 @@ sub write { } $xfer += $output->writeFieldEnd(); } + if (defined $self->{rowId}) { + $xfer += $output->writeFieldBegin('rowId', TType::STRING, 16); + $xfer += $output->writeString($self->{rowId}); + $xfer += $output->writeFieldEnd(); + } $xfer += $output->writeFieldStop(); $xfer += $output->writeStructEnd(); return $xfer; http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/ccdd40fc/distribution/src/main/scripts/interface/gen-rb/blur_types.rb ---------------------------------------------------------------------- diff --git a/distribution/src/main/scripts/interface/gen-rb/blur_types.rb b/distribution/src/main/scripts/interface/gen-rb/blur_types.rb index 48cc80d..77f3b19 100644 --- a/distribution/src/main/scripts/interface/gen-rb/blur_types.rb +++ b/distribution/src/main/scripts/interface/gen-rb/blur_types.rb @@ -427,6 +427,7 @@ module Blur CACHERESULT = 13 STARTTIME = 14 SORTFIELDS = 15 + ROWID = 16 FIELDS = { # The query information. @@ -455,7 +456,10 @@ module Blur CACHERESULT => {:type => ::Thrift::Types::BOOL, :name => 'cacheResult', :default => true}, # Sets the start time, if 0 the controller sets the time. STARTTIME => {:type => ::Thrift::Types::I64, :name => 'startTime', :default => 0}, - SORTFIELDS => {:type => ::Thrift::Types::LIST, :name => 'sortFields', :element => {:type => ::Thrift::Types::STRUCT, :class => ::Blur::SortField}} + # The sortfields are applied in order to sort the results. + SORTFIELDS => {:type => ::Thrift::Types::LIST, :name => 'sortFields', :element => {:type => ::Thrift::Types::STRUCT, :class => ::Blur::SortField}}, + # Optional optimization for record queries to run against a single row. This will allow the query to be executed on one and only one shard in the cluster. + ROWID => {:type => ::Thrift::Types::STRING, :name => 'rowId'} } def struct_fields; FIELDS; end http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/ccdd40fc/docs/Blur.html ---------------------------------------------------------------------- diff --git a/docs/Blur.html b/docs/Blur.html index 7f4ae2b..b9c2c66 100644 --- a/docs/Blur.html +++ b/docs/Blur.html @@ -419,7 +419,10 @@ of a running query can be found or the query can be canceled. </td><td>default</td><td>1</td></tr> <tr><td>14</td><td>startTime</td><td><code>i64</code></td><td>Sets the start time, if 0 the controller sets the time. </td><td>default</td><td>0</td></tr> -<tr><td>15</td><td>sortFields</td><td><code>list<<code><a href="Blur.html#Struct_SortField">SortField</a></code>></code></td><td></td><td>default</td><td></td></tr> +<tr><td>15</td><td>sortFields</td><td><code>list<<code><a href="Blur.html#Struct_SortField">SortField</a></code>></code></td><td>The sortfields are applied in order to sort the results. +</td><td>default</td><td></td></tr> +<tr><td>16</td><td>rowId</td><td><code>string</code></td><td>Optional optimization for record queries to run against a single row. This will allow the query to be executed on one and only one shard in the cluster. +</td><td>default</td><td></td></tr> </table><br/>The Blur Query object that contains the query that needs to be executed along with the query options. <br/></p></section><section><div class="page-header"><h3 id="Struct_SortFieldResult">Struct: SortFieldResult</h3></div><p class="lead">
