incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amccu...@apache.org
Subject [1/9] Adding missing thrift method for getting the location of shards in the cluster. Also added a new attribute to queryargs.
Date Mon, 31 Dec 2012 20:44:03 GMT
http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/d783db83/src/blur-thrift/src/main/java/org/apache/blur/thrift/generated/QueryArgs.java
----------------------------------------------------------------------
diff --git a/src/blur-thrift/src/main/java/org/apache/blur/thrift/generated/QueryArgs.java
b/src/blur-thrift/src/main/java/org/apache/blur/thrift/generated/QueryArgs.java
index 3ce0c09..3746dd8 100644
--- a/src/blur-thrift/src/main/java/org/apache/blur/thrift/generated/QueryArgs.java
+++ b/src/blur-thrift/src/main/java/org/apache/blur/thrift/generated/QueryArgs.java
@@ -57,10 +57,11 @@ public class QueryArgs implements org.apache.thrift.TBase<QueryArgs,
QueryArgs._
   private static final org.apache.thrift.protocol.TField QUERY_FIELD_DESC = new org.apache.thrift.protocol.TField("query",
org.apache.thrift.protocol.TType.STRING, (short)3);
   private static final org.apache.thrift.protocol.TField FILTER_FIELD_DESC = new org.apache.thrift.protocol.TField("filter",
org.apache.thrift.protocol.TType.STRING, (short)4);
   private static final org.apache.thrift.protocol.TField NUMBER_TO_FETCH_FIELD_DESC = new
org.apache.thrift.protocol.TField("numberToFetch", org.apache.thrift.protocol.TType.I32, (short)5);
-  private static final org.apache.thrift.protocol.TField SORT_FIELD_DESC = new org.apache.thrift.protocol.TField("sort",
org.apache.thrift.protocol.TType.STRUCT, (short)6);
-  private static final org.apache.thrift.protocol.TField DO_DOC_SCORES_FIELD_DESC = new org.apache.thrift.protocol.TField("doDocScores",
org.apache.thrift.protocol.TType.BOOL, (short)7);
-  private static final org.apache.thrift.protocol.TField DO_MAX_SCORE_FIELD_DESC = new org.apache.thrift.protocol.TField("doMaxScore",
org.apache.thrift.protocol.TType.BOOL, (short)8);
-  private static final org.apache.thrift.protocol.TField SHARD_INDEXES_FIELD_DESC = new org.apache.thrift.protocol.TField("shardIndexes",
org.apache.thrift.protocol.TType.LIST, (short)9);
+  private static final org.apache.thrift.protocol.TField AGGREGATE_RESULTS_FIELD_DESC = new
org.apache.thrift.protocol.TField("aggregateResults", org.apache.thrift.protocol.TType.BOOL,
(short)6);
+  private static final org.apache.thrift.protocol.TField SORT_FIELD_DESC = new org.apache.thrift.protocol.TField("sort",
org.apache.thrift.protocol.TType.STRUCT, (short)7);
+  private static final org.apache.thrift.protocol.TField DO_DOC_SCORES_FIELD_DESC = new org.apache.thrift.protocol.TField("doDocScores",
org.apache.thrift.protocol.TType.BOOL, (short)8);
+  private static final org.apache.thrift.protocol.TField DO_MAX_SCORE_FIELD_DESC = new org.apache.thrift.protocol.TField("doMaxScore",
org.apache.thrift.protocol.TType.BOOL, (short)9);
+  private static final org.apache.thrift.protocol.TField SHARD_INDEXES_FIELD_DESC = new org.apache.thrift.protocol.TField("shardIndexes",
org.apache.thrift.protocol.TType.LIST, (short)10);
 
   private static final Map<Class<? extends IScheme>, SchemeFactory> schemes =
new HashMap<Class<? extends IScheme>, SchemeFactory>();
   static {
@@ -68,27 +69,101 @@ public class QueryArgs implements org.apache.thrift.TBase<QueryArgs,
QueryArgs._
     schemes.put(TupleScheme.class, new QueryArgsTupleSchemeFactory());
   }
 
+  /**
+   * Unique id for controlling the given query.
+   */
   public long id; // required
+  /**
+   * If after is left null then the first N (where N is numberToFetch)
+   * ScoreDocs are fetched.  If after is not null then the first N
+   * ScoreDocs are fetched that occur after the given ScoreDoc.
+   */
   public ScoreDoc after; // required
+  /**
+   * The query to be executed.
+   */
   public ByteBuffer query; // required
+  /**
+   * Filter to be executed.
+   */
   public ByteBuffer filter; // required
+  /**
+   * The number of document locations to fetch.
+   */
   public int numberToFetch; // required
+  /**
+   * If aggregate results is left true then only a single TopFieldDocs
+   * object will be returned from the search method.  It will contain
+   * only the best documents from the given search with all of the
+   * shards being sorted and aggregated together.
+   */
+  public boolean aggregateResults; // required
+  /**
+   * NOT YET IMPLEMENTED.
+   */
   public Sort sort; // required
+  /**
+   * NOT YET IMPLEMENTED.  Related to sort.
+   */
   public boolean doDocScores; // required
+  /**
+   * Calculate the max score of the search.
+   */
   public boolean doMaxScore; // required
+  /**
+   * Shard indexes allows the user to specify which shards of the table to execute
+   * the query against.  If left null, all the shards of the table are used.
+   */
   public List<Integer> shardIndexes; // required
 
   /** The set of fields this struct contains, along with convenience methods for finding
and manipulating them. */
   public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+    /**
+     * Unique id for controlling the given query.
+     */
     ID((short)1, "id"),
+    /**
+     * If after is left null then the first N (where N is numberToFetch)
+     * ScoreDocs are fetched.  If after is not null then the first N
+     * ScoreDocs are fetched that occur after the given ScoreDoc.
+     */
     AFTER((short)2, "after"),
+    /**
+     * The query to be executed.
+     */
     QUERY((short)3, "query"),
+    /**
+     * Filter to be executed.
+     */
     FILTER((short)4, "filter"),
+    /**
+     * The number of document locations to fetch.
+     */
     NUMBER_TO_FETCH((short)5, "numberToFetch"),
-    SORT((short)6, "sort"),
-    DO_DOC_SCORES((short)7, "doDocScores"),
-    DO_MAX_SCORE((short)8, "doMaxScore"),
-    SHARD_INDEXES((short)9, "shardIndexes");
+    /**
+     * If aggregate results is left true then only a single TopFieldDocs
+     * object will be returned from the search method.  It will contain
+     * only the best documents from the given search with all of the
+     * shards being sorted and aggregated together.
+     */
+    AGGREGATE_RESULTS((short)6, "aggregateResults"),
+    /**
+     * NOT YET IMPLEMENTED.
+     */
+    SORT((short)7, "sort"),
+    /**
+     * NOT YET IMPLEMENTED.  Related to sort.
+     */
+    DO_DOC_SCORES((short)8, "doDocScores"),
+    /**
+     * Calculate the max score of the search.
+     */
+    DO_MAX_SCORE((short)9, "doMaxScore"),
+    /**
+     * Shard indexes allows the user to specify which shards of the table to execute
+     * the query against.  If left null, all the shards of the table are used.
+     */
+    SHARD_INDEXES((short)10, "shardIndexes");
 
     private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
 
@@ -113,13 +188,15 @@ public class QueryArgs implements org.apache.thrift.TBase<QueryArgs,
QueryArgs._
           return FILTER;
         case 5: // NUMBER_TO_FETCH
           return NUMBER_TO_FETCH;
-        case 6: // SORT
+        case 6: // AGGREGATE_RESULTS
+          return AGGREGATE_RESULTS;
+        case 7: // SORT
           return SORT;
-        case 7: // DO_DOC_SCORES
+        case 8: // DO_DOC_SCORES
           return DO_DOC_SCORES;
-        case 8: // DO_MAX_SCORE
+        case 9: // DO_MAX_SCORE
           return DO_MAX_SCORE;
-        case 9: // SHARD_INDEXES
+        case 10: // SHARD_INDEXES
           return SHARD_INDEXES;
         default:
           return null;
@@ -163,8 +240,9 @@ public class QueryArgs implements org.apache.thrift.TBase<QueryArgs,
QueryArgs._
   // isset id assignments
   private static final int __ID_ISSET_ID = 0;
   private static final int __NUMBERTOFETCH_ISSET_ID = 1;
-  private static final int __DODOCSCORES_ISSET_ID = 2;
-  private static final int __DOMAXSCORE_ISSET_ID = 3;
+  private static final int __AGGREGATERESULTS_ISSET_ID = 2;
+  private static final int __DODOCSCORES_ISSET_ID = 3;
+  private static final int __DOMAXSCORE_ISSET_ID = 4;
   private byte __isset_bitfield = 0;
   public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
   static {
@@ -179,6 +257,8 @@ public class QueryArgs implements org.apache.thrift.TBase<QueryArgs,
QueryArgs._
         new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING
       , true)));
     tmpMap.put(_Fields.NUMBER_TO_FETCH, new org.apache.thrift.meta_data.FieldMetaData("numberToFetch",
org.apache.thrift.TFieldRequirementType.DEFAULT, 
         new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
+    tmpMap.put(_Fields.AGGREGATE_RESULTS, new org.apache.thrift.meta_data.FieldMetaData("aggregateResults",
org.apache.thrift.TFieldRequirementType.DEFAULT, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
     tmpMap.put(_Fields.SORT, new org.apache.thrift.meta_data.FieldMetaData("sort", org.apache.thrift.TFieldRequirementType.DEFAULT,

         new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT,
Sort.class)));
     tmpMap.put(_Fields.DO_DOC_SCORES, new org.apache.thrift.meta_data.FieldMetaData("doDocScores",
org.apache.thrift.TFieldRequirementType.DEFAULT, 
@@ -195,6 +275,8 @@ public class QueryArgs implements org.apache.thrift.TBase<QueryArgs,
QueryArgs._
   public QueryArgs() {
     this.numberToFetch = 100;
 
+    this.aggregateResults = true;
+
     this.doDocScores = true;
 
     this.doMaxScore = false;
@@ -207,6 +289,7 @@ public class QueryArgs implements org.apache.thrift.TBase<QueryArgs,
QueryArgs._
     ByteBuffer query,
     ByteBuffer filter,
     int numberToFetch,
+    boolean aggregateResults,
     Sort sort,
     boolean doDocScores,
     boolean doMaxScore,
@@ -220,6 +303,8 @@ public class QueryArgs implements org.apache.thrift.TBase<QueryArgs,
QueryArgs._
     this.filter = filter;
     this.numberToFetch = numberToFetch;
     setNumberToFetchIsSet(true);
+    this.aggregateResults = aggregateResults;
+    setAggregateResultsIsSet(true);
     this.sort = sort;
     this.doDocScores = doDocScores;
     setDoDocScoresIsSet(true);
@@ -246,6 +331,7 @@ public class QueryArgs implements org.apache.thrift.TBase<QueryArgs,
QueryArgs._
 ;
     }
     this.numberToFetch = other.numberToFetch;
+    this.aggregateResults = other.aggregateResults;
     if (other.isSetSort()) {
       this.sort = new Sort(other.sort);
     }
@@ -273,6 +359,8 @@ public class QueryArgs implements org.apache.thrift.TBase<QueryArgs,
QueryArgs._
     this.filter = null;
     this.numberToFetch = 100;
 
+    this.aggregateResults = true;
+
     this.sort = null;
     this.doDocScores = true;
 
@@ -281,10 +369,16 @@ public class QueryArgs implements org.apache.thrift.TBase<QueryArgs,
QueryArgs._
     this.shardIndexes = null;
   }
 
+  /**
+   * Unique id for controlling the given query.
+   */
   public long getId() {
     return this.id;
   }
 
+  /**
+   * Unique id for controlling the given query.
+   */
   public QueryArgs setId(long id) {
     this.id = id;
     setIdIsSet(true);
@@ -304,10 +398,20 @@ public class QueryArgs implements org.apache.thrift.TBase<QueryArgs,
QueryArgs._
     __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __ID_ISSET_ID, value);
   }
 
+  /**
+   * If after is left null then the first N (where N is numberToFetch)
+   * ScoreDocs are fetched.  If after is not null then the first N
+   * ScoreDocs are fetched that occur after the given ScoreDoc.
+   */
   public ScoreDoc getAfter() {
     return this.after;
   }
 
+  /**
+   * If after is left null then the first N (where N is numberToFetch)
+   * ScoreDocs are fetched.  If after is not null then the first N
+   * ScoreDocs are fetched that occur after the given ScoreDoc.
+   */
   public QueryArgs setAfter(ScoreDoc after) {
     this.after = after;
     return this;
@@ -328,6 +432,9 @@ public class QueryArgs implements org.apache.thrift.TBase<QueryArgs,
QueryArgs._
     }
   }
 
+  /**
+   * The query to be executed.
+   */
   public byte[] getQuery() {
     setQuery(org.apache.thrift.TBaseHelper.rightSize(query));
     return query == null ? null : query.array();
@@ -337,6 +444,9 @@ public class QueryArgs implements org.apache.thrift.TBase<QueryArgs,
QueryArgs._
     return query;
   }
 
+  /**
+   * The query to be executed.
+   */
   public QueryArgs setQuery(byte[] query) {
     setQuery(query == null ? (ByteBuffer)null : ByteBuffer.wrap(query));
     return this;
@@ -362,6 +472,9 @@ public class QueryArgs implements org.apache.thrift.TBase<QueryArgs,
QueryArgs._
     }
   }
 
+  /**
+   * Filter to be executed.
+   */
   public byte[] getFilter() {
     setFilter(org.apache.thrift.TBaseHelper.rightSize(filter));
     return filter == null ? null : filter.array();
@@ -371,6 +484,9 @@ public class QueryArgs implements org.apache.thrift.TBase<QueryArgs,
QueryArgs._
     return filter;
   }
 
+  /**
+   * Filter to be executed.
+   */
   public QueryArgs setFilter(byte[] filter) {
     setFilter(filter == null ? (ByteBuffer)null : ByteBuffer.wrap(filter));
     return this;
@@ -396,10 +512,16 @@ public class QueryArgs implements org.apache.thrift.TBase<QueryArgs,
QueryArgs._
     }
   }
 
+  /**
+   * The number of document locations to fetch.
+   */
   public int getNumberToFetch() {
     return this.numberToFetch;
   }
 
+  /**
+   * The number of document locations to fetch.
+   */
   public QueryArgs setNumberToFetch(int numberToFetch) {
     this.numberToFetch = numberToFetch;
     setNumberToFetchIsSet(true);
@@ -419,10 +541,51 @@ public class QueryArgs implements org.apache.thrift.TBase<QueryArgs,
QueryArgs._
     __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __NUMBERTOFETCH_ISSET_ID, value);
   }
 
+  /**
+   * If aggregate results is left true then only a single TopFieldDocs
+   * object will be returned from the search method.  It will contain
+   * only the best documents from the given search with all of the
+   * shards being sorted and aggregated together.
+   */
+  public boolean isAggregateResults() {
+    return this.aggregateResults;
+  }
+
+  /**
+   * If aggregate results is left true then only a single TopFieldDocs
+   * object will be returned from the search method.  It will contain
+   * only the best documents from the given search with all of the
+   * shards being sorted and aggregated together.
+   */
+  public QueryArgs setAggregateResults(boolean aggregateResults) {
+    this.aggregateResults = aggregateResults;
+    setAggregateResultsIsSet(true);
+    return this;
+  }
+
+  public void unsetAggregateResults() {
+    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __AGGREGATERESULTS_ISSET_ID);
+  }
+
+  /** Returns true if field aggregateResults is set (has been assigned a value) and false
otherwise */
+  public boolean isSetAggregateResults() {
+    return EncodingUtils.testBit(__isset_bitfield, __AGGREGATERESULTS_ISSET_ID);
+  }
+
+  public void setAggregateResultsIsSet(boolean value) {
+    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __AGGREGATERESULTS_ISSET_ID,
value);
+  }
+
+  /**
+   * NOT YET IMPLEMENTED.
+   */
   public Sort getSort() {
     return this.sort;
   }
 
+  /**
+   * NOT YET IMPLEMENTED.
+   */
   public QueryArgs setSort(Sort sort) {
     this.sort = sort;
     return this;
@@ -443,10 +606,16 @@ public class QueryArgs implements org.apache.thrift.TBase<QueryArgs,
QueryArgs._
     }
   }
 
+  /**
+   * NOT YET IMPLEMENTED.  Related to sort.
+   */
   public boolean isDoDocScores() {
     return this.doDocScores;
   }
 
+  /**
+   * NOT YET IMPLEMENTED.  Related to sort.
+   */
   public QueryArgs setDoDocScores(boolean doDocScores) {
     this.doDocScores = doDocScores;
     setDoDocScoresIsSet(true);
@@ -466,10 +635,16 @@ public class QueryArgs implements org.apache.thrift.TBase<QueryArgs,
QueryArgs._
     __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __DODOCSCORES_ISSET_ID, value);
   }
 
+  /**
+   * Calculate the max score of the search.
+   */
   public boolean isDoMaxScore() {
     return this.doMaxScore;
   }
 
+  /**
+   * Calculate the max score of the search.
+   */
   public QueryArgs setDoMaxScore(boolean doMaxScore) {
     this.doMaxScore = doMaxScore;
     setDoMaxScoreIsSet(true);
@@ -504,10 +679,18 @@ public class QueryArgs implements org.apache.thrift.TBase<QueryArgs,
QueryArgs._
     this.shardIndexes.add(elem);
   }
 
+  /**
+   * Shard indexes allows the user to specify which shards of the table to execute
+   * the query against.  If left null, all the shards of the table are used.
+   */
   public List<Integer> getShardIndexes() {
     return this.shardIndexes;
   }
 
+  /**
+   * Shard indexes allows the user to specify which shards of the table to execute
+   * the query against.  If left null, all the shards of the table are used.
+   */
   public QueryArgs setShardIndexes(List<Integer> shardIndexes) {
     this.shardIndexes = shardIndexes;
     return this;
@@ -570,6 +753,14 @@ public class QueryArgs implements org.apache.thrift.TBase<QueryArgs,
QueryArgs._
       }
       break;
 
+    case AGGREGATE_RESULTS:
+      if (value == null) {
+        unsetAggregateResults();
+      } else {
+        setAggregateResults((Boolean)value);
+      }
+      break;
+
     case SORT:
       if (value == null) {
         unsetSort();
@@ -622,6 +813,9 @@ public class QueryArgs implements org.apache.thrift.TBase<QueryArgs,
QueryArgs._
     case NUMBER_TO_FETCH:
       return Integer.valueOf(getNumberToFetch());
 
+    case AGGREGATE_RESULTS:
+      return Boolean.valueOf(isAggregateResults());
+
     case SORT:
       return getSort();
 
@@ -655,6 +849,8 @@ public class QueryArgs implements org.apache.thrift.TBase<QueryArgs,
QueryArgs._
       return isSetFilter();
     case NUMBER_TO_FETCH:
       return isSetNumberToFetch();
+    case AGGREGATE_RESULTS:
+      return isSetAggregateResults();
     case SORT:
       return isSetSort();
     case DO_DOC_SCORES:
@@ -725,6 +921,15 @@ public class QueryArgs implements org.apache.thrift.TBase<QueryArgs,
QueryArgs._
         return false;
     }
 
+    boolean this_present_aggregateResults = true;
+    boolean that_present_aggregateResults = true;
+    if (this_present_aggregateResults || that_present_aggregateResults) {
+      if (!(this_present_aggregateResults && that_present_aggregateResults))
+        return false;
+      if (this.aggregateResults != that.aggregateResults)
+        return false;
+    }
+
     boolean this_present_sort = true && this.isSetSort();
     boolean that_present_sort = true && that.isSetSort();
     if (this_present_sort || that_present_sort) {
@@ -827,6 +1032,16 @@ public class QueryArgs implements org.apache.thrift.TBase<QueryArgs,
QueryArgs._
         return lastComparison;
       }
     }
+    lastComparison = Boolean.valueOf(isSetAggregateResults()).compareTo(typedOther.isSetAggregateResults());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetAggregateResults()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.aggregateResults, typedOther.aggregateResults);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
     lastComparison = Boolean.valueOf(isSetSort()).compareTo(typedOther.isSetSort());
     if (lastComparison != 0) {
       return lastComparison;
@@ -919,6 +1134,10 @@ public class QueryArgs implements org.apache.thrift.TBase<QueryArgs,
QueryArgs._
     sb.append(this.numberToFetch);
     first = false;
     if (!first) sb.append(", ");
+    sb.append("aggregateResults:");
+    sb.append(this.aggregateResults);
+    first = false;
+    if (!first) sb.append(", ");
     sb.append("sort:");
     if (this.sort == null) {
       sb.append("null");
@@ -1034,7 +1253,15 @@ public class QueryArgs implements org.apache.thrift.TBase<QueryArgs,
QueryArgs._
               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
             }
             break;
-          case 6: // SORT
+          case 6: // AGGREGATE_RESULTS
+            if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
+              struct.aggregateResults = iprot.readBool();
+              struct.setAggregateResultsIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          case 7: // SORT
             if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
               struct.sort = new Sort();
               struct.sort.read(iprot);
@@ -1043,7 +1270,7 @@ public class QueryArgs implements org.apache.thrift.TBase<QueryArgs,
QueryArgs._
               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
             }
             break;
-          case 7: // DO_DOC_SCORES
+          case 8: // DO_DOC_SCORES
             if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
               struct.doDocScores = iprot.readBool();
               struct.setDoDocScoresIsSet(true);
@@ -1051,7 +1278,7 @@ public class QueryArgs implements org.apache.thrift.TBase<QueryArgs,
QueryArgs._
               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
             }
             break;
-          case 8: // DO_MAX_SCORE
+          case 9: // DO_MAX_SCORE
             if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
               struct.doMaxScore = iprot.readBool();
               struct.setDoMaxScoreIsSet(true);
@@ -1059,7 +1286,7 @@ public class QueryArgs implements org.apache.thrift.TBase<QueryArgs,
QueryArgs._
               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
             }
             break;
-          case 9: // SHARD_INDEXES
+          case 10: // SHARD_INDEXES
             if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
               {
                 org.apache.thrift.protocol.TList _list80 = iprot.readListBegin();
@@ -1113,6 +1340,9 @@ public class QueryArgs implements org.apache.thrift.TBase<QueryArgs,
QueryArgs._
       oprot.writeFieldBegin(NUMBER_TO_FETCH_FIELD_DESC);
       oprot.writeI32(struct.numberToFetch);
       oprot.writeFieldEnd();
+      oprot.writeFieldBegin(AGGREGATE_RESULTS_FIELD_DESC);
+      oprot.writeBool(struct.aggregateResults);
+      oprot.writeFieldEnd();
       if (struct.sort != null) {
         oprot.writeFieldBegin(SORT_FIELD_DESC);
         struct.sort.write(oprot);
@@ -1169,19 +1399,22 @@ public class QueryArgs implements org.apache.thrift.TBase<QueryArgs,
QueryArgs._
       if (struct.isSetNumberToFetch()) {
         optionals.set(4);
       }
-      if (struct.isSetSort()) {
+      if (struct.isSetAggregateResults()) {
         optionals.set(5);
       }
-      if (struct.isSetDoDocScores()) {
+      if (struct.isSetSort()) {
         optionals.set(6);
       }
-      if (struct.isSetDoMaxScore()) {
+      if (struct.isSetDoDocScores()) {
         optionals.set(7);
       }
-      if (struct.isSetShardIndexes()) {
+      if (struct.isSetDoMaxScore()) {
         optionals.set(8);
       }
-      oprot.writeBitSet(optionals, 9);
+      if (struct.isSetShardIndexes()) {
+        optionals.set(9);
+      }
+      oprot.writeBitSet(optionals, 10);
       if (struct.isSetId()) {
         oprot.writeI64(struct.id);
       }
@@ -1197,6 +1430,9 @@ public class QueryArgs implements org.apache.thrift.TBase<QueryArgs,
QueryArgs._
       if (struct.isSetNumberToFetch()) {
         oprot.writeI32(struct.numberToFetch);
       }
+      if (struct.isSetAggregateResults()) {
+        oprot.writeBool(struct.aggregateResults);
+      }
       if (struct.isSetSort()) {
         struct.sort.write(oprot);
       }
@@ -1220,7 +1456,7 @@ public class QueryArgs implements org.apache.thrift.TBase<QueryArgs,
QueryArgs._
     @Override
     public void read(org.apache.thrift.protocol.TProtocol prot, QueryArgs struct) throws
org.apache.thrift.TException {
       TTupleProtocol iprot = (TTupleProtocol) prot;
-      BitSet incoming = iprot.readBitSet(9);
+      BitSet incoming = iprot.readBitSet(10);
       if (incoming.get(0)) {
         struct.id = iprot.readI64();
         struct.setIdIsSet(true);
@@ -1243,19 +1479,23 @@ public class QueryArgs implements org.apache.thrift.TBase<QueryArgs,
QueryArgs._
         struct.setNumberToFetchIsSet(true);
       }
       if (incoming.get(5)) {
+        struct.aggregateResults = iprot.readBool();
+        struct.setAggregateResultsIsSet(true);
+      }
+      if (incoming.get(6)) {
         struct.sort = new Sort();
         struct.sort.read(iprot);
         struct.setSortIsSet(true);
       }
-      if (incoming.get(6)) {
+      if (incoming.get(7)) {
         struct.doDocScores = iprot.readBool();
         struct.setDoDocScoresIsSet(true);
       }
-      if (incoming.get(7)) {
+      if (incoming.get(8)) {
         struct.doMaxScore = iprot.readBool();
         struct.setDoMaxScoreIsSet(true);
       }
-      if (incoming.get(8)) {
+      if (incoming.get(9)) {
         {
           org.apache.thrift.protocol.TList _list85 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.I32,
iprot.readI32());
           struct.shardIndexes = new ArrayList<Integer>(_list85.size);

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/d783db83/src/blur-thrift/src/main/java/org/apache/blur/thrift/generated/ShardLayout.java
----------------------------------------------------------------------
diff --git a/src/blur-thrift/src/main/java/org/apache/blur/thrift/generated/ShardLayout.java
b/src/blur-thrift/src/main/java/org/apache/blur/thrift/generated/ShardLayout.java
new file mode 100644
index 0000000..f4c359e
--- /dev/null
+++ b/src/blur-thrift/src/main/java/org/apache/blur/thrift/generated/ShardLayout.java
@@ -0,0 +1,581 @@
+/**
+ * Autogenerated by Thrift Compiler (0.9.0)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ *  @generated
+ */
+package org.apache.blur.thrift.generated;
+
+/**
+ * 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 org.apache.thrift.scheme.IScheme;
+import org.apache.thrift.scheme.SchemeFactory;
+import org.apache.thrift.scheme.StandardScheme;
+
+import org.apache.thrift.scheme.TupleScheme;
+import org.apache.thrift.protocol.TTupleProtocol;
+import org.apache.thrift.protocol.TProtocolException;
+import org.apache.thrift.EncodingUtils;
+import org.apache.thrift.TException;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.EnumMap;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.EnumSet;
+import java.util.Collections;
+import java.util.BitSet;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class ShardLayout implements org.apache.thrift.TBase<ShardLayout, ShardLayout._Fields>,
java.io.Serializable, Cloneable {
+  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ShardLayout");
+
+  private static final org.apache.thrift.protocol.TField SERVER_FIELD_DESC = new org.apache.thrift.protocol.TField("server",
org.apache.thrift.protocol.TType.STRING, (short)1);
+  private static final org.apache.thrift.protocol.TField SHARDS_FIELD_DESC = new org.apache.thrift.protocol.TField("shards",
org.apache.thrift.protocol.TType.LIST, (short)2);
+
+  private static final Map<Class<? extends IScheme>, SchemeFactory> schemes =
new HashMap<Class<? extends IScheme>, SchemeFactory>();
+  static {
+    schemes.put(StandardScheme.class, new ShardLayoutStandardSchemeFactory());
+    schemes.put(TupleScheme.class, new ShardLayoutTupleSchemeFactory());
+  }
+
+  /**
+   * The server for this layout.
+   */
+  public String server; // required
+  /**
+   * A list of shard ids for the given server.
+   */
+  public List<Integer> shards; // required
+
+  /** The set of fields this struct contains, along with convenience methods for finding
and manipulating them. */
+  public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+    /**
+     * The server for this layout.
+     */
+    SERVER((short)1, "server"),
+    /**
+     * A list of shard ids for the given server.
+     */
+    SHARDS((short)2, "shards");
+
+    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
+
+    static {
+      for (_Fields field : EnumSet.allOf(_Fields.class)) {
+        byName.put(field.getFieldName(), field);
+      }
+    }
+
+    /**
+     * Find the _Fields constant that matches fieldId, or null if its not found.
+     */
+    public static _Fields findByThriftId(int fieldId) {
+      switch(fieldId) {
+        case 1: // SERVER
+          return SERVER;
+        case 2: // SHARDS
+          return SHARDS;
+        default:
+          return null;
+      }
+    }
+
+    /**
+     * Find the _Fields constant that matches fieldId, throwing an exception
+     * if it is not found.
+     */
+    public static _Fields findByThriftIdOrThrow(int fieldId) {
+      _Fields fields = findByThriftId(fieldId);
+      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't
exist!");
+      return fields;
+    }
+
+    /**
+     * Find the _Fields constant that matches name, or null if its not found.
+     */
+    public static _Fields findByName(String name) {
+      return byName.get(name);
+    }
+
+    private final short _thriftId;
+    private final String _fieldName;
+
+    _Fields(short thriftId, String fieldName) {
+      _thriftId = thriftId;
+      _fieldName = fieldName;
+    }
+
+    public short getThriftFieldId() {
+      return _thriftId;
+    }
+
+    public String getFieldName() {
+      return _fieldName;
+    }
+  }
+
+  // isset id assignments
+  public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+  static {
+    Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields,
org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+    tmpMap.put(_Fields.SERVER, new org.apache.thrift.meta_data.FieldMetaData("server", org.apache.thrift.TFieldRequirementType.DEFAULT,

+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+    tmpMap.put(_Fields.SHARDS, new org.apache.thrift.meta_data.FieldMetaData("shards", org.apache.thrift.TFieldRequirementType.DEFAULT,

+        new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST,

+            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))));
+    metaDataMap = Collections.unmodifiableMap(tmpMap);
+    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(ShardLayout.class, metaDataMap);
+  }
+
+  public ShardLayout() {
+  }
+
+  public ShardLayout(
+    String server,
+    List<Integer> shards)
+  {
+    this();
+    this.server = server;
+    this.shards = shards;
+  }
+
+  /**
+   * Performs a deep copy on <i>other</i>.
+   */
+  public ShardLayout(ShardLayout other) {
+    if (other.isSetServer()) {
+      this.server = other.server;
+    }
+    if (other.isSetShards()) {
+      List<Integer> __this__shards = new ArrayList<Integer>();
+      for (Integer other_element : other.shards) {
+        __this__shards.add(other_element);
+      }
+      this.shards = __this__shards;
+    }
+  }
+
+  public ShardLayout deepCopy() {
+    return new ShardLayout(this);
+  }
+
+  @Override
+  public void clear() {
+    this.server = null;
+    this.shards = null;
+  }
+
+  /**
+   * The server for this layout.
+   */
+  public String getServer() {
+    return this.server;
+  }
+
+  /**
+   * The server for this layout.
+   */
+  public ShardLayout setServer(String server) {
+    this.server = server;
+    return this;
+  }
+
+  public void unsetServer() {
+    this.server = null;
+  }
+
+  /** Returns true if field server is set (has been assigned a value) and false otherwise
*/
+  public boolean isSetServer() {
+    return this.server != null;
+  }
+
+  public void setServerIsSet(boolean value) {
+    if (!value) {
+      this.server = null;
+    }
+  }
+
+  public int getShardsSize() {
+    return (this.shards == null) ? 0 : this.shards.size();
+  }
+
+  public java.util.Iterator<Integer> getShardsIterator() {
+    return (this.shards == null) ? null : this.shards.iterator();
+  }
+
+  public void addToShards(int elem) {
+    if (this.shards == null) {
+      this.shards = new ArrayList<Integer>();
+    }
+    this.shards.add(elem);
+  }
+
+  /**
+   * A list of shard ids for the given server.
+   */
+  public List<Integer> getShards() {
+    return this.shards;
+  }
+
+  /**
+   * A list of shard ids for the given server.
+   */
+  public ShardLayout setShards(List<Integer> shards) {
+    this.shards = shards;
+    return this;
+  }
+
+  public void unsetShards() {
+    this.shards = null;
+  }
+
+  /** Returns true if field shards is set (has been assigned a value) and false otherwise
*/
+  public boolean isSetShards() {
+    return this.shards != null;
+  }
+
+  public void setShardsIsSet(boolean value) {
+    if (!value) {
+      this.shards = null;
+    }
+  }
+
+  public void setFieldValue(_Fields field, Object value) {
+    switch (field) {
+    case SERVER:
+      if (value == null) {
+        unsetServer();
+      } else {
+        setServer((String)value);
+      }
+      break;
+
+    case SHARDS:
+      if (value == null) {
+        unsetShards();
+      } else {
+        setShards((List<Integer>)value);
+      }
+      break;
+
+    }
+  }
+
+  public Object getFieldValue(_Fields field) {
+    switch (field) {
+    case SERVER:
+      return getServer();
+
+    case SHARDS:
+      return getShards();
+
+    }
+    throw new IllegalStateException();
+  }
+
+  /** Returns true if field corresponding to fieldID is set (has been assigned a value) and
false otherwise */
+  public boolean isSet(_Fields field) {
+    if (field == null) {
+      throw new IllegalArgumentException();
+    }
+
+    switch (field) {
+    case SERVER:
+      return isSetServer();
+    case SHARDS:
+      return isSetShards();
+    }
+    throw new IllegalStateException();
+  }
+
+  @Override
+  public boolean equals(Object that) {
+    if (that == null)
+      return false;
+    if (that instanceof ShardLayout)
+      return this.equals((ShardLayout)that);
+    return false;
+  }
+
+  public boolean equals(ShardLayout that) {
+    if (that == null)
+      return false;
+
+    boolean this_present_server = true && this.isSetServer();
+    boolean that_present_server = true && that.isSetServer();
+    if (this_present_server || that_present_server) {
+      if (!(this_present_server && that_present_server))
+        return false;
+      if (!this.server.equals(that.server))
+        return false;
+    }
+
+    boolean this_present_shards = true && this.isSetShards();
+    boolean that_present_shards = true && that.isSetShards();
+    if (this_present_shards || that_present_shards) {
+      if (!(this_present_shards && that_present_shards))
+        return false;
+      if (!this.shards.equals(that.shards))
+        return false;
+    }
+
+    return true;
+  }
+
+  @Override
+  public int hashCode() {
+    return 0;
+  }
+
+  public int compareTo(ShardLayout other) {
+    if (!getClass().equals(other.getClass())) {
+      return getClass().getName().compareTo(other.getClass().getName());
+    }
+
+    int lastComparison = 0;
+    ShardLayout typedOther = (ShardLayout)other;
+
+    lastComparison = Boolean.valueOf(isSetServer()).compareTo(typedOther.isSetServer());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetServer()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.server, typedOther.server);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    lastComparison = Boolean.valueOf(isSetShards()).compareTo(typedOther.isSetShards());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetShards()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.shards, typedOther.shards);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    return 0;
+  }
+
+  public _Fields fieldForId(int fieldId) {
+    return _Fields.findByThriftId(fieldId);
+  }
+
+  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException
{
+    schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
+  }
+
+  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException
{
+    schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
+  }
+
+  @Override
+  public String toString() {
+    StringBuilder sb = new StringBuilder("ShardLayout(");
+    boolean first = true;
+
+    sb.append("server:");
+    if (this.server == null) {
+      sb.append("null");
+    } else {
+      sb.append(this.server);
+    }
+    first = false;
+    if (!first) sb.append(", ");
+    sb.append("shards:");
+    if (this.shards == null) {
+      sb.append("null");
+    } else {
+      sb.append(this.shards);
+    }
+    first = false;
+    sb.append(")");
+    return sb.toString();
+  }
+
+  public void validate() throws org.apache.thrift.TException {
+    // check for required fields
+    // check for sub-struct validity
+  }
+
+  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+    try {
+      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+    } catch (org.apache.thrift.TException te) {
+      throw new java.io.IOException(te);
+    }
+  }
+
+  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException
{
+    try {
+      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
+    } catch (org.apache.thrift.TException te) {
+      throw new java.io.IOException(te);
+    }
+  }
+
+  private static class ShardLayoutStandardSchemeFactory implements SchemeFactory {
+    public ShardLayoutStandardScheme getScheme() {
+      return new ShardLayoutStandardScheme();
+    }
+  }
+
+  private static class ShardLayoutStandardScheme extends StandardScheme<ShardLayout>
{
+
+    public void read(org.apache.thrift.protocol.TProtocol iprot, ShardLayout struct) throws
org.apache.thrift.TException {
+      org.apache.thrift.protocol.TField schemeField;
+      iprot.readStructBegin();
+      while (true)
+      {
+        schemeField = iprot.readFieldBegin();
+        if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
+          break;
+        }
+        switch (schemeField.id) {
+          case 1: // SERVER
+            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+              struct.server = iprot.readString();
+              struct.setServerIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          case 2: // SHARDS
+            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
+              {
+                org.apache.thrift.protocol.TList _list120 = iprot.readListBegin();
+                struct.shards = new ArrayList<Integer>(_list120.size);
+                for (int _i121 = 0; _i121 < _list120.size; ++_i121)
+                {
+                  int _elem122; // required
+                  _elem122 = iprot.readI32();
+                  struct.shards.add(_elem122);
+                }
+                iprot.readListEnd();
+              }
+              struct.setShardsIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          default:
+            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+        }
+        iprot.readFieldEnd();
+      }
+      iprot.readStructEnd();
+
+      // check for required fields of primitive type, which can't be checked in the validate
method
+      struct.validate();
+    }
+
+    public void write(org.apache.thrift.protocol.TProtocol oprot, ShardLayout struct) throws
org.apache.thrift.TException {
+      struct.validate();
+
+      oprot.writeStructBegin(STRUCT_DESC);
+      if (struct.server != null) {
+        oprot.writeFieldBegin(SERVER_FIELD_DESC);
+        oprot.writeString(struct.server);
+        oprot.writeFieldEnd();
+      }
+      if (struct.shards != null) {
+        oprot.writeFieldBegin(SHARDS_FIELD_DESC);
+        {
+          oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.I32,
struct.shards.size()));
+          for (int _iter123 : struct.shards)
+          {
+            oprot.writeI32(_iter123);
+          }
+          oprot.writeListEnd();
+        }
+        oprot.writeFieldEnd();
+      }
+      oprot.writeFieldStop();
+      oprot.writeStructEnd();
+    }
+
+  }
+
+  private static class ShardLayoutTupleSchemeFactory implements SchemeFactory {
+    public ShardLayoutTupleScheme getScheme() {
+      return new ShardLayoutTupleScheme();
+    }
+  }
+
+  private static class ShardLayoutTupleScheme extends TupleScheme<ShardLayout> {
+
+    @Override
+    public void write(org.apache.thrift.protocol.TProtocol prot, ShardLayout struct) throws
org.apache.thrift.TException {
+      TTupleProtocol oprot = (TTupleProtocol) prot;
+      BitSet optionals = new BitSet();
+      if (struct.isSetServer()) {
+        optionals.set(0);
+      }
+      if (struct.isSetShards()) {
+        optionals.set(1);
+      }
+      oprot.writeBitSet(optionals, 2);
+      if (struct.isSetServer()) {
+        oprot.writeString(struct.server);
+      }
+      if (struct.isSetShards()) {
+        {
+          oprot.writeI32(struct.shards.size());
+          for (int _iter124 : struct.shards)
+          {
+            oprot.writeI32(_iter124);
+          }
+        }
+      }
+    }
+
+    @Override
+    public void read(org.apache.thrift.protocol.TProtocol prot, ShardLayout struct) throws
org.apache.thrift.TException {
+      TTupleProtocol iprot = (TTupleProtocol) prot;
+      BitSet incoming = iprot.readBitSet(2);
+      if (incoming.get(0)) {
+        struct.server = iprot.readString();
+        struct.setServerIsSet(true);
+      }
+      if (incoming.get(1)) {
+        {
+          org.apache.thrift.protocol.TList _list125 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.I32,
iprot.readI32());
+          struct.shards = new ArrayList<Integer>(_list125.size);
+          for (int _i126 = 0; _i126 < _list125.size; ++_i126)
+          {
+            int _elem127; // required
+            _elem127 = iprot.readI32();
+            struct.shards.add(_elem127);
+          }
+        }
+        struct.setShardsIsSet(true);
+      }
+    }
+  }
+
+}
+


Mime
View raw message