com.atlassian.jira.issue.statistics.util
Class AbstractOneDimensionalHitCollector

java.lang.Object
  extended by org.apache.lucene.search.Collector
      extended by com.atlassian.jira.issue.statistics.util.AbstractOneDimensionalHitCollector
Direct Known Subclasses:
OneDimensionalDocIssueHitCollector, OneDimensionalTermHitCollector

@Internal
public abstract class AbstractOneDimensionalHitCollector
extends org.apache.lucene.search.Collector

Used to traverse a query and collect if the specified one dimension is relevant, this will keep track of the irrelevant count. This class implements Collector which is a callback mechanism for use by IndexSearcher, but it is widely abused and called directly from within JIRA.

Since:
v4.0

Constructor Summary
AbstractOneDimensionalHitCollector(String documentFieldId, FieldVisibilityManager fieldVisibilityManager, ReaderCache readerCache, FieldManager fieldManager, ProjectManager projectManager)
           
AbstractOneDimensionalHitCollector(String documentFieldId, org.apache.lucene.index.IndexReader indexReader, FieldVisibilityManager fieldVisibilityManager, ReaderCache readerCache, FieldManager fieldManager, ProjectManager projectManager)
          Deprecated. since v5.1.8. Use AbstractOneDimensionalHitCollector(String, FieldVisibilityManager, ReaderCache, FieldManager, ProjectManager) and call setNextReader for each reader segment, that is if you are calling {@link #collect(int) directly and not just passing the Collector to Lucene.
 
Method Summary
 boolean acceptsDocsOutOfOrder()
           
 void collect(int i)
          Collect hits.
protected abstract  void collectIrrelevant(int docId)
          Implement this if you would like to do something when the hit collector has encountered a docId that contains an irrelevant data match
protected abstract  void collectWithTerms(int docId, Collection<String> terms)
          Implement this if you would like to do something with the hit we have found.
 long getHitCount()
          Returns the number of times the collect(int) method was called.
 long getIrrelevantCount()
           
 void setNextReader(org.apache.lucene.index.IndexReader reader, int docBase)
           
 void setScorer(org.apache.lucene.search.Scorer scorer)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractOneDimensionalHitCollector

public AbstractOneDimensionalHitCollector(String documentFieldId,
                                          org.apache.lucene.index.IndexReader indexReader,
                                          FieldVisibilityManager fieldVisibilityManager,
                                          ReaderCache readerCache,
                                          FieldManager fieldManager,
                                          ProjectManager projectManager)
Deprecated. since v5.1.8. Use AbstractOneDimensionalHitCollector(String, FieldVisibilityManager, ReaderCache, FieldManager, ProjectManager) and call setNextReader for each reader segment, that is if you are calling {@link #collect(int) directly and not just passing the Collector to Lucene.


AbstractOneDimensionalHitCollector

public AbstractOneDimensionalHitCollector(String documentFieldId,
                                          FieldVisibilityManager fieldVisibilityManager,
                                          ReaderCache readerCache,
                                          FieldManager fieldManager,
                                          ProjectManager projectManager)
Since:
v5.1.8
Method Detail

setScorer

public void setScorer(org.apache.lucene.search.Scorer scorer)
               throws IOException
Specified by:
setScorer in class org.apache.lucene.search.Collector
Throws:
IOException

setNextReader

public void setNextReader(org.apache.lucene.index.IndexReader reader,
                          int docBase)
Specified by:
setNextReader in class org.apache.lucene.search.Collector

acceptsDocsOutOfOrder

public boolean acceptsDocsOutOfOrder()
Specified by:
acceptsDocsOutOfOrder in class org.apache.lucene.search.Collector

collect

public void collect(int i)
Collect hits. When accessing our value caches we do not need to increment i by the docBase as the value caches are built against the current (segment) reader. When calling the abstract collectXXX() methods these expect the index of the whole reader and so we need to use (i + docBase)

Specified by:
collect in class org.apache.lucene.search.Collector
Parameters:
i - Index to the current reader

getIrrelevantCount

public long getIrrelevantCount()

getHitCount

public long getHitCount()
Returns the number of times the collect(int) method was called. This should return the number of unique issues that was matched during a search.

Returns:
number of times the collect(int) method was called.

collectIrrelevant

protected abstract void collectIrrelevant(int docId)
Implement this if you would like to do something when the hit collector has encountered a docId that contains an irrelevant data match

Parameters:
docId - the match we have found. This is an index into the overall directory reader.

collectWithTerms

protected abstract void collectWithTerms(int docId,
                                         Collection<String> terms)
Implement this if you would like to do something with the hit we have found.

Parameters:
docId - the doc id of the hit. This is an index into the overall directory reader.
terms - the terms for the fieldId for this document, pre-calculated so you may not need to call getDocument


Copyright © 2002-2014 Atlassian. All Rights Reserved.