@Test public void combineEmptyShouldGiveNiceEmptyList() throws IOException, InterruptedException { Map<Shard, List<String>> execResults = Maps.newHashMap(); List<String> expected = Lists.newArrayList(); TermsCommand cmd = new TermsCommand(); List<String> returned = cmd.combine(new TestCombiningContext(), execResults); assertEquals(expected, returned); }
@Override public List<String> combine(CombiningContext context, Map<? extends Location<?>, List<String>> results) throws IOException, InterruptedException { SortedSet<String> terms = Sets.newTreeSet(); for (List<String> t : results.values()) { terms.addAll(t); } return Lists.newArrayList(terms).subList(0, Math.min((int) size, terms.size())); }
TermsCommand extends ClusterServerReadCommandSingleTable<List<String>> { @Override public List<String> combine(CombiningContext context, Map<? extends Location<?>, List<String>> results) throws IOException, InterruptedException { SortedSet<String> terms = Sets.newTreeSet(); for (List<String> t : results.values()) { terms.addAll(t); } return Lists.newArrayList(terms).subList(0, Math.min((int) size, terms.size())); } }
TermsCommand extends ClusterServerReadCommandSingleTable<List<String>> { @Override public List<String> combine(CombiningContext context, Map<? extends Location<?>, List<String>> results) throws IOException, InterruptedException { SortedSet<String> terms = Sets.newTreeSet(); for (List<String> t : results.values()) { terms.addAll(t); } return Lists.newArrayList(terms).subList(0, Math.min((int) size, terms.size())); }  }
TermsCommand extends ClusterServerReadCommandSingleTable<List<String>> { @Override public List<String> combine(CombiningContext context, Map<? extends Location<?>, List<String>> results) throws IOException, InterruptedException { SortedSet<String> terms = Sets.newTreeSet(); for (List<String> t : results.values()) { terms.addAll(t); } return Lists.newArrayList(terms).subList(0, Math.min((int) size, terms.size())); }  @Override List<String> execute(IndexContext context); @Override List<String> combine(CombiningContext context, Map<? extends Location<?>, List<String>> results); @Override String getName(); short getSize(); void setSize(short size); String getFieldName(); void setFieldName(String fieldName); String getStartWith(); void setStartWith(String startWith); }
TermsCommand extends ClusterServerReadCommandSingleTable<List<String>> { @Override public List<String> combine(CombiningContext context, Map<? extends Location<?>, List<String>> results) throws IOException, InterruptedException { SortedSet<String> terms = Sets.newTreeSet(); for (List<String> t : results.values()) { terms.addAll(t); } return Lists.newArrayList(terms).subList(0, Math.min((int) size, terms.size())); }  @Override List<String> execute(IndexContext context); @Override List<String> combine(CombiningContext context, Map<? extends Location<?>, List<String>> results); @Override String getName(); short getSize(); void setSize(short size); String getFieldName(); void setFieldName(String fieldName); String getStartWith(); void setStartWith(String startWith);  }