|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ObjectGroupCounts
public class GroupCounts
Maintains an ongoing count of groups and how many document hits were found in each group.
Nested Class Summary | |
---|---|
static interface |
GroupCounts.DocHitMaker
|
static interface |
GroupCounts.HitQueueMaker
|
Field Summary | |
---|---|
private int[] |
count
|
private int |
curMark
|
private GroupData |
data
|
private PriorityQueue[] |
hitQueue
|
private GroupCounts.HitQueueMaker |
hitQueueMaker
|
private int[] |
mark
|
private int[] |
maxDocs
|
private boolean |
prepMode
|
private float[] |
score
|
private int[] |
selection
|
private static int |
SORT_BY_MAX_DOC_SCORE
|
private static int |
SORT_BY_REVERSE_VALUE
|
private static int |
SORT_BY_TOTAL_DOCS
|
private static int |
SORT_BY_VALUE
|
private int[] |
sortedChild
|
private int[] |
sortedSibling
|
private FacetSpec |
spec
|
private int[] |
startDoc
|
Constructor Summary | |
---|---|
GroupCounts(GroupData groupData,
FacetSpec spec,
GroupCounts.HitQueueMaker hitQueueMaker)
Construct an object with all counts at zero |
Method Summary | |
---|---|
void |
addDoc(GroupCounts.DocHitMaker docHitMaker)
Add a document hit to the counts |
private void |
buildDocHits(int group,
ResultGroup resultGroup)
Construct the array of doc hits for the hit group. |
ResultGroup |
buildResultGroup(int parent)
|
int |
child(int group)
Get the first child of the given group, in properly sorted order |
private static int |
compare(float x,
float y)
Compare two floats for sorting purposes |
private static int |
compare(int x,
int y)
Compare two ints for sorting purposes |
private int |
compare(int g1,
int g2,
int sortKind)
Compare two groups for sorting purposes. |
private void |
conservativePrep()
Gather data about which groups to gather DocHits for. |
private int |
countDescendants(int group)
Utility function to count the group and all of its descendants |
void |
gatherDocs(int group,
int startDoc,
int maxDocs)
Called by GroupSelector to mark groups to receive documents |
ResultFacet |
getResult()
Retrieve the result facet with its groupings. |
boolean |
isSelected(int group)
Find out whether the given group is selected |
String |
name(int group)
Get the name of a specific group |
int |
nDocHits(int group)
Find out the number of doc hits for the given group |
int |
nGroups()
Get the total number of groups |
boolean |
nondefaultSort()
Called by GroupSelector to find out if the ordering is non-default |
int |
parent(int group)
Get the parent of the given group |
float |
score(int group)
Find out the score of the given group |
void |
selectGroup(int group)
Called by GroupSelector to select a given group |
boolean |
shouldInclude(int group)
Called by GroupSelector to find out if it should include a given group |
int |
sibling(int group)
Get the next sibling of the given group, in properly sorted order |
private void |
sortAndSelect()
Called during the prep phase for dynamic groups, and in the result building phase for static groups. |
private void |
sortChildren(int parent,
int sortKind)
|
private void |
sortGroups()
Re-sort the hierarchy according to the facet spec, and store the new child/sibling relationships. |
Methods inherited from class Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private GroupData data
private FacetSpec spec
private GroupCounts.HitQueueMaker hitQueueMaker
private boolean prepMode
private int[] count
private float[] score
private int[] mark
private int[] selection
private int[] startDoc
private int[] maxDocs
private PriorityQueue[] hitQueue
private int[] sortedChild
private int[] sortedSibling
private int curMark
private static final int SORT_BY_VALUE
private static final int SORT_BY_REVERSE_VALUE
private static final int SORT_BY_TOTAL_DOCS
private static final int SORT_BY_MAX_DOC_SCORE
Constructor Detail |
---|
public GroupCounts(GroupData groupData, FacetSpec spec, GroupCounts.HitQueueMaker hitQueueMaker)
Method Detail |
---|
private void conservativePrep()
public final void selectGroup(int group)
public final void gatherDocs(int group, int startDoc, int maxDocs)
public final boolean nondefaultSort()
public final boolean shouldInclude(int group)
public final int nGroups()
public final int child(int group)
public final int sibling(int group)
public final int parent(int group)
public final String name(int group)
public final boolean isSelected(int group)
public final int nDocHits(int group)
public final float score(int group)
public void addDoc(GroupCounts.DocHitMaker docHitMaker)
public ResultFacet getResult()
private void sortAndSelect()
public ResultGroup buildResultGroup(int parent)
private void sortGroups()
private int countDescendants(int group)
private void buildDocHits(int group, ResultGroup resultGroup)
private void sortChildren(int parent, int sortKind)
private int compare(int g1, int g2, int sortKind)
private static int compare(int x, int y)
private static int compare(float x, float y)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |