|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.lucene.facet.search.results.MutableFacetResultNode
public class MutableFacetResultNode
Mutable implementation for Result of faceted search for a certain taxonomy node.
Constructor Summary | |
---|---|
MutableFacetResultNode(FacetResultNode other,
boolean takeSubResults)
Create a mutable facet result node from another result node |
|
MutableFacetResultNode(int ordinal,
double value)
Create a Facet Result Node. |
|
MutableFacetResultNode(int ordinal,
double value,
double residue,
CategoryPath label,
List<FacetResultNode> subResults)
Create a Facet Result Node. |
Method Summary | |
---|---|
void |
appendSubResult(FacetResultNode subRes)
Append a sub result (as last). |
CategoryPath |
getLabel()
Category path of the category of this result, or null if not computed, because the application did not request to compute it. |
CategoryPath |
getLabel(TaxonomyReader taxonomyReader)
Category path of the category of this result. |
int |
getNumSubResults()
Number of sub results |
int |
getOrdinal()
Ordinal of the category of this result. |
double |
getResidue()
Value of screened out sub results. |
Iterable<? extends FacetResultNode> |
getSubResults()
Contained sub results. |
double |
getValue()
Value of this result - usually either count or a value derived from some computing on the association of it. |
void |
increaseResidue(double addedResidue)
increase the residue for this result. |
void |
increaseValue(double addedValue)
increase the value for this result. |
void |
insertSubResult(FacetResultNode subRes)
Insert sub result (as first). |
void |
reset(int ordinal,
double value)
Reset a facet Result Node. |
void |
setLabel(CategoryPath label)
Set the label of the category of this result. |
void |
setResidue(double residue)
Set the residue. |
void |
setSubResults(List<FacetResultNode> subResults)
Set the sub results. |
void |
setValue(double value)
Set the value of this result. |
static MutableFacetResultNode |
toImpl(FacetResultNode frn)
Internal utility: turn a result node into an implementation class with richer API that allows modifying it. |
String |
toString()
|
String |
toString(String prefix)
String representation of this facet result node. |
void |
trimSubResults(int size)
Trim sub results to a given size. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public MutableFacetResultNode(int ordinal, double value)
ordinal
- ordinal in the taxonomy of the category of this result.value
- value this result.public MutableFacetResultNode(int ordinal, double value, double residue, CategoryPath label, List<FacetResultNode> subResults)
ordinal
- ordinal in the taxonomy of the category of this result.value
- value of this result.residue
- Value of screened out sub results.label
- label of the category path of this result.subResults
- - sub results, usually descendants, sometimes child results, of
this result - depending on the request.public MutableFacetResultNode(FacetResultNode other, boolean takeSubResults)
other
- other result node to copy fromtakeSubResults
- set to true to take also sub results of other nodeMethod Detail |
---|
public void reset(int ordinal, double value)
Used at the population of facet results, not intended for regular use by applications.
ordinal
- ordinal in the taxonomy of the category of this result.value
- value of this result.public String toString()
toString
in class Object
public String toString(String prefix)
FacetResultNode
toString
in interface FacetResultNode
prefix
- prefix for each result linepublic final int getOrdinal()
FacetResultNode
getOrdinal
in interface FacetResultNode
public final CategoryPath getLabel()
FacetResultNode
FacetResultNode.getLabel(TaxonomyReader)
.
getLabel
in interface FacetResultNode
FacetRequest.getNumLabel()
,
FacetResultNode.getLabel(TaxonomyReader)
public void setLabel(CategoryPath label)
label
- the label to set.getLabel()
public final double getValue()
FacetResultNode
getValue
in interface FacetResultNode
public void setValue(double value)
setValue
in interface FacetResultNode
value
- the value to setgetValue()
public void increaseValue(double addedValue)
addedValue
- the value to addgetValue()
public final double getResidue()
FacetResultNode
If only part of valid results are returned, e.g. because top K were requested, provide info on "what else is there under this result node".
getResidue
in interface FacetResultNode
public void setResidue(double residue)
residue
- the residue to setgetResidue()
public void increaseResidue(double addedResidue)
addedResidue
- the residue to addgetResidue()
public final Iterable<? extends FacetResultNode> getSubResults()
FacetResultNode
getSubResults
in interface FacetResultNode
public void trimSubResults(int size)
Note: Although the getResidue()
is not guaranteed to be
accurate, it is worth fixing it, as possible, by taking under account the
trimmed sub-nodes.
public void setSubResults(List<FacetResultNode> subResults)
subResults
- the sub-results to setpublic void appendSubResult(FacetResultNode subRes)
subRes
- sub-result to be appendedpublic void insertSubResult(FacetResultNode subRes)
subRes
- sub-result to be insertedpublic final CategoryPath getLabel(TaxonomyReader taxonomyReader) throws IOException
FacetResultNode
Use with caution: loading a label for results is costly, performance wise. Therefore force labels loading only when really needed.
getLabel
in interface FacetResultNode
taxonomyReader
- taxonomy reader for forcing (lazy) labeling of this result.
IOException
- on errorFacetRequest.getNumLabel()
public final int getNumSubResults()
FacetResultNode
getNumSubResults
in interface FacetResultNode
public static MutableFacetResultNode toImpl(FacetResultNode frn)
In case that input result node is already of an implementation class only casting is done, but in any case we pay the price of checking "instance of".
frn
- facet result node to be turned into an implementation class object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |