@Test public void testRecordFrequency() throws Exception { assertEquals(2, indexManager.recordFrequency(TABLE, FAMILY, "testcol1", "value1")); assertEquals(0, indexManager.recordFrequency(TABLE, FAMILY, "testcol1", "NO VALUE")); }
public long recordFrequency(final String table, final String columnFamily, final String columnName, final String value) throws Exception { Map<String, BlurIndex> blurIndexes; try { blurIndexes = _indexServer.getIndexes(table); } catch (IOException e) { LOG.error("Unknown error while trying to fetch index readers.", e); throw new BException(e.getMessage(), e); } return ForkJoin.execute(_executor, blurIndexes.entrySet(), new ParallelCall<Entry<String, BlurIndex>, Long>() { @Override public Long call(Entry<String, BlurIndex> input) throws Exception { BlurIndex index = input.getValue(); IndexReader reader = index.getIndexReader(); try { return recordFrequency(reader, columnFamily, columnName, value); } finally { reader.decRef(); } } }).merge(new Merger<Long>() { @Override public Long merge(BlurExecutorCompletionService<Long> service) throws BlurException { long total = 0; while (service.getRemainingCount() > 0) { Future<Long> future = service.poll(_defaultParallelCallTimeout, TimeUnit.MILLISECONDS, true, table, columnFamily, columnName, value); total += service.getResultThrowException(future, table, columnFamily, columnName, value); } return total; } }); }
IndexManager { public long recordFrequency(final String table, final String columnFamily, final String columnName, final String value) throws Exception { Map<String, BlurIndex> blurIndexes; try { blurIndexes = _indexServer.getIndexes(table); } catch (IOException e) { LOG.error("Unknown error while trying to fetch index readers.", e); throw new BException(e.getMessage(), e); } return ForkJoin.execute(_executor, blurIndexes.entrySet(), new ParallelCall<Entry<String, BlurIndex>, Long>() { @Override public Long call(Entry<String, BlurIndex> input) throws Exception { BlurIndex index = input.getValue(); IndexReader reader = index.getIndexReader(); try { return recordFrequency(reader, columnFamily, columnName, value); } finally { reader.decRef(); } } }).merge(new Merger<Long>() { @Override public Long merge(BlurExecutorCompletionService<Long> service) throws BlurException { long total = 0; while (service.getRemainingCount() > 0) { Future<Long> future = service.poll(_defaultParallelCallTimeout, TimeUnit.MILLISECONDS, true, table, columnFamily, columnName, value); total += service.getResultThrowException(future, table, columnFamily, columnName, value); } return total; } }); } }
IndexManager { public long recordFrequency(final String table, final String columnFamily, final String columnName, final String value) throws Exception { Map<String, BlurIndex> blurIndexes; try { blurIndexes = _indexServer.getIndexes(table); } catch (IOException e) { LOG.error("Unknown error while trying to fetch index readers.", e); throw new BException(e.getMessage(), e); } return ForkJoin.execute(_executor, blurIndexes.entrySet(), new ParallelCall<Entry<String, BlurIndex>, Long>() { @Override public Long call(Entry<String, BlurIndex> input) throws Exception { BlurIndex index = input.getValue(); IndexReader reader = index.getIndexReader(); try { return recordFrequency(reader, columnFamily, columnName, value); } finally { reader.decRef(); } } }).merge(new Merger<Long>() { @Override public Long merge(BlurExecutorCompletionService<Long> service) throws BlurException { long total = 0; while (service.getRemainingCount() > 0) { Future<Long> future = service.poll(_defaultParallelCallTimeout, TimeUnit.MILLISECONDS, true, table, columnFamily, columnName, value); total += service.getResultThrowException(future, table, columnFamily, columnName, value); } return total; } }); }  }
IndexManager { public long recordFrequency(final String table, final String columnFamily, final String columnName, final String value) throws Exception { Map<String, BlurIndex> blurIndexes; try { blurIndexes = _indexServer.getIndexes(table); } catch (IOException e) { LOG.error("Unknown error while trying to fetch index readers.", e); throw new BException(e.getMessage(), e); } return ForkJoin.execute(_executor, blurIndexes.entrySet(), new ParallelCall<Entry<String, BlurIndex>, Long>() { @Override public Long call(Entry<String, BlurIndex> input) throws Exception { BlurIndex index = input.getValue(); IndexReader reader = index.getIndexReader(); try { return recordFrequency(reader, columnFamily, columnName, value); } finally { reader.decRef(); } } }).merge(new Merger<Long>() { @Override public Long merge(BlurExecutorCompletionService<Long> service) throws BlurException { long total = 0; while (service.getRemainingCount() > 0) { Future<Long> future = service.poll(_defaultParallelCallTimeout, TimeUnit.MILLISECONDS, true, table, columnFamily, columnName, value); total += service.getResultThrowException(future, table, columnFamily, columnName, value); } return total; } }); }  void setMaxClauseCount(int maxClauseCount); void init(); synchronized void close(); void fetchRow(String table, Selector selector, FetchResult fetchResult); static void validSelector(Selector selector); BlurResultIterable query(final String table, final BlurQuery blurQuery, AtomicLongArray facetedCounts); void cancelQuery(String table, long uuid); List<BlurQueryStatus> currentQueries(String table); BlurQueryStatus queryStatus(String table, long uuid); List<Long> queryStatusIdList(String table); static void fetchRow(IndexReader reader, String table, Selector selector, FetchResult fetchResult); static FieldSelector getFieldSelector(final Selector selector); IndexServer getIndexServer(); void setIndexServer(IndexServer indexServer); long recordFrequency(final String table, final String columnFamily, final String columnName, final String value); List<String> terms(final String table, final String columnFamily, final String columnName, final String startWith, final short size); static long recordFrequency(IndexReader reader, String columnFamily, String columnName, String value); static List<String> terms(IndexReader reader, String columnFamily, String columnName, String startWith, short size); Schema schema(String table); void setStatusCleanupTimerDelay(long delay); void mutate(final RowMutation mutation); void mutate(final List<RowMutation> mutations); void setThreadCount(int threadCount); void setBlurMetrics(BlurMetrics blurMetrics); void setFilterCache(BlurFilterCache filterCache); void optimize(String table, int numberOfSegmentsPerShard); }
IndexManager { public long recordFrequency(final String table, final String columnFamily, final String columnName, final String value) throws Exception { Map<String, BlurIndex> blurIndexes; try { blurIndexes = _indexServer.getIndexes(table); } catch (IOException e) { LOG.error("Unknown error while trying to fetch index readers.", e); throw new BException(e.getMessage(), e); } return ForkJoin.execute(_executor, blurIndexes.entrySet(), new ParallelCall<Entry<String, BlurIndex>, Long>() { @Override public Long call(Entry<String, BlurIndex> input) throws Exception { BlurIndex index = input.getValue(); IndexReader reader = index.getIndexReader(); try { return recordFrequency(reader, columnFamily, columnName, value); } finally { reader.decRef(); } } }).merge(new Merger<Long>() { @Override public Long merge(BlurExecutorCompletionService<Long> service) throws BlurException { long total = 0; while (service.getRemainingCount() > 0) { Future<Long> future = service.poll(_defaultParallelCallTimeout, TimeUnit.MILLISECONDS, true, table, columnFamily, columnName, value); total += service.getResultThrowException(future, table, columnFamily, columnName, value); } return total; } }); }  void setMaxClauseCount(int maxClauseCount); void init(); synchronized void close(); void fetchRow(String table, Selector selector, FetchResult fetchResult); static void validSelector(Selector selector); BlurResultIterable query(final String table, final BlurQuery blurQuery, AtomicLongArray facetedCounts); void cancelQuery(String table, long uuid); List<BlurQueryStatus> currentQueries(String table); BlurQueryStatus queryStatus(String table, long uuid); List<Long> queryStatusIdList(String table); static void fetchRow(IndexReader reader, String table, Selector selector, FetchResult fetchResult); static FieldSelector getFieldSelector(final Selector selector); IndexServer getIndexServer(); void setIndexServer(IndexServer indexServer); long recordFrequency(final String table, final String columnFamily, final String columnName, final String value); List<String> terms(final String table, final String columnFamily, final String columnName, final String startWith, final short size); static long recordFrequency(IndexReader reader, String columnFamily, String columnName, String value); static List<String> terms(IndexReader reader, String columnFamily, String columnName, String startWith, short size); Schema schema(String table); void setStatusCleanupTimerDelay(long delay); void mutate(final RowMutation mutation); void mutate(final List<RowMutation> mutations); void setThreadCount(int threadCount); void setBlurMetrics(BlurMetrics blurMetrics); void setFilterCache(BlurFilterCache filterCache); void optimize(String table, int numberOfSegmentsPerShard);  }