Package org.apache.solr.search.facet
Class RelatednessAgg
- java.lang.Object
-
- org.apache.lucene.queries.function.ValueSource
-
- org.apache.solr.search.facet.AggValueSource
-
- org.apache.solr.search.facet.RelatednessAgg
-
public class RelatednessAgg extends AggValueSource
An aggregation function designed to be nested under other (possibly deeply nested) facets for the purposes of computing the "relatedness" of facet buckets relative to "foreground" and "background" sets -- primarily for the purpose of building "Semantic Knowledge Graphs"
-
-
Field Summary
Fields Modifier and Type Field Description protected org.apache.lucene.search.QuerybgQprotected org.apache.lucene.search.QueryfgQprotected doublemin_popstatic StringNAMEstatic StringSWEEP_COLLECTION-
Fields inherited from class org.apache.solr.search.facet.AggValueSource
name
-
-
Constructor Summary
Constructors Constructor Description RelatednessAgg(org.apache.lucene.search.Query fgQ, org.apache.lucene.search.Query bgQ)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static doublecomputeRelatedness(long fg_count, long fg_size, long bg_count, long bg_size)This is an aproximated Z-Score, as described in the "Scoring Semantic Relationships" section of "The Semantic Knowledge Graph: A compact, auto-generated model for real-time traversal and ranking of any relationship within a domain"FacetMergercreateFacetMerger(Object prototype)SlotAcccreateSlotAcc(FacetContext fcontext, long numDocs, int numSlots)Stringdescription()booleanequals(Object o)org.apache.lucene.queries.function.FunctionValuesgetValues(Map<Object,Object> context, org.apache.lucene.index.LeafReaderContext readerContext)inthashCode()static doubleroundTo5Digits(double val)Helper function for rounding/truncating relatedness & popularity values to 5 decimal digits, since these values are all probabilistic more then 5 digits aren't really relevant and may give a missleading impression of added precision.voidsetOpts(QParser parser)-
Methods inherited from class org.apache.solr.search.facet.AggValueSource
getChildren, name
-
-
-
-
Field Detail
-
SWEEP_COLLECTION
public static final String SWEEP_COLLECTION
- See Also:
- Constant Field Values
-
fgQ
protected final org.apache.lucene.search.Query fgQ
-
bgQ
protected final org.apache.lucene.search.Query bgQ
-
min_pop
protected double min_pop
-
NAME
public static final String NAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
setOpts
public void setOpts(QParser parser)
-
description
public String description()
- Specified by:
descriptionin classorg.apache.lucene.queries.function.ValueSource
-
equals
public boolean equals(Object o)
- Overrides:
equalsin classAggValueSource
-
hashCode
public int hashCode()
- Specified by:
hashCodein classorg.apache.lucene.queries.function.ValueSource
-
getValues
public org.apache.lucene.queries.function.FunctionValues getValues(Map<Object,Object> context, org.apache.lucene.index.LeafReaderContext readerContext) throws IOException
- Overrides:
getValuesin classAggValueSource- Throws:
IOException
-
createSlotAcc
public SlotAcc createSlotAcc(FacetContext fcontext, long numDocs, int numSlots) throws IOException
- Overrides:
createSlotAccin classAggValueSource- Throws:
IOException
-
createFacetMerger
public FacetMerger createFacetMerger(Object prototype)
- Specified by:
createFacetMergerin classAggValueSource
-
computeRelatedness
public static double computeRelatedness(long fg_count, long fg_size, long bg_count, long bg_size)This is an aproximated Z-Score, as described in the "Scoring Semantic Relationships" section of "The Semantic Knowledge Graph: A compact, auto-generated model for real-time traversal and ranking of any relationship within a domain"See Also:
-
roundTo5Digits
public static double roundTo5Digits(double val)
Helper function for rounding/truncating relatedness & popularity values to 5 decimal digits, since these values are all probabilistic more then 5 digits aren't really relevant and may give a missleading impression of added precision.
-
-