com.pyxis.greenhopper.jira.util.collector
Class SummaryStatsCollector

java.lang.Object
  extended by org.apache.lucene.search.Collector
      extended by com.atlassian.jira.issue.statistics.util.DocumentHitCollector
          extended by com.pyxis.greenhopper.jira.util.collector.SummaryStatsCollector
Direct Known Subclasses:
SummaryIssueStatsCollector, SummaryStatsCollector2

public class SummaryStatsCollector
extends com.atlassian.jira.issue.statistics.util.DocumentHitCollector

This HitCollector is called for every version we want statistics for. It will load the related issue document and upgrade the stats counter. Going through the Lucene index this way is faster for a large number of versions than firing individual counting queries, mainly due to JIRA's excessive permission checking. The downside is that each issue document has to be fetched, which by itself is slower than just working on the hit index. Yet, it's still about 50% faster than using individual queries. The HitCollector can be configured to discriminate by different fields using the keyField.

Author:
ahennecke

Field Summary
protected  java.lang.String[] keyFields
          The name of the Lucene field that contains the key value for the stats map (like version ID)
 
Fields inherited from class com.atlassian.jira.issue.statistics.util.DocumentHitCollector
searcher
 
Constructor Summary
  SummaryStatsCollector(org.apache.lucene.search.IndexSearcher searcher, BoardContext boardContext, java.lang.String... keyFields)
          StatsCollectors are not thread-safe.
protected SummaryStatsCollector(org.apache.lucene.search.IndexSearcher searcher, StepBoard todoStep, StepBoard doneStep, java.util.Set<WatchedField> watchedFields, java.lang.String... keyFields)
           
 
Method Summary
 void collect(org.apache.lucene.document.Document d)
          This callback will be called by lucene for each found issue document
 java.util.Map<java.lang.String,Summary> getStats()
           
 
Methods inherited from class com.atlassian.jira.issue.statistics.util.DocumentHitCollector
acceptsDocsOutOfOrder, collect, setNextReader, setScorer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

keyFields

protected final java.lang.String[] keyFields
The name of the Lucene field that contains the key value for the stats map (like version ID)

Constructor Detail

SummaryStatsCollector

protected SummaryStatsCollector(org.apache.lucene.search.IndexSearcher searcher,
                                StepBoard todoStep,
                                StepBoard doneStep,
                                java.util.Set<WatchedField> watchedFields,
                                java.lang.String... keyFields)

SummaryStatsCollector

public SummaryStatsCollector(org.apache.lucene.search.IndexSearcher searcher,
                             BoardContext boardContext,
                             java.lang.String... keyFields)
StatsCollectors are not thread-safe. Please create a new one for each request.

Parameters:
searcher - : The Lucene searcher
keyFields - : The fields that identifies the key for the summaries
boardContext - : BoardContext to base the stats on.
Method Detail

collect

public void collect(org.apache.lucene.document.Document d)
This callback will be called by lucene for each found issue document

Specified by:
collect in class com.atlassian.jira.issue.statistics.util.DocumentHitCollector

getStats

public java.util.Map<java.lang.String,Summary> getStats()


Copyright © 2007-2012 Atlassian. All Rights Reserved.