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.Query
bgQ
protected org.apache.lucene.search.Query
fgQ
protected double
min_pop
static String
NAME
static String
SWEEP_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 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"FacetMerger
createFacetMerger(Object prototype)
SlotAcc
createSlotAcc(FacetContext fcontext, long numDocs, int numSlots)
String
description()
boolean
equals(Object o)
org.apache.lucene.queries.function.FunctionValues
getValues(Map<Object,Object> context, org.apache.lucene.index.LeafReaderContext readerContext)
int
hashCode()
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.void
setOpts(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:
description
in classorg.apache.lucene.queries.function.ValueSource
-
equals
public boolean equals(Object o)
- Overrides:
equals
in classAggValueSource
-
hashCode
public int hashCode()
- Specified by:
hashCode
in 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:
getValues
in classAggValueSource
- Throws:
IOException
-
createSlotAcc
public SlotAcc createSlotAcc(FacetContext fcontext, long numDocs, int numSlots) throws IOException
- Overrides:
createSlotAcc
in classAggValueSource
- Throws:
IOException
-
createFacetMerger
public FacetMerger createFacetMerger(Object prototype)
- Specified by:
createFacetMerger
in 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.
-
-