public virtual void TestIntSumAssociation() { FacetsCollector fc = new FacetsCollector(); IndexSearcher searcher = NewSearcher(reader); searcher.Search(new MatchAllDocsQuery(), fc); Facets facets = new TaxonomyFacetSumInt32Associations("$facets.int", taxoReader, config, fc); Assert.AreEqual("dim=int path=[] value=-1 childCount=2\n a (200)\n b (150)\n", facets.GetTopChildren(10, "int").ToString()); Assert.AreEqual(200, (int)facets.GetSpecificValue("int", "a"), "Wrong count for category 'a'!"); Assert.AreEqual(150, (int)facets.GetSpecificValue("int", "b"), "Wrong count for category 'b'!"); }
public virtual void TestIntSumAssociationDrillDown() { FacetsCollector fc = new FacetsCollector(); IndexSearcher searcher = NewSearcher(reader); DrillDownQuery q = new DrillDownQuery(config); q.Add("int", "b"); searcher.Search(q, fc); Facets facets = new TaxonomyFacetSumInt32Associations("$facets.int", taxoReader, config, fc); Assert.AreEqual("dim=int path=[] value=-1 childCount=2\n b (150)\n a (100)\n", facets.GetTopChildren(10, "int").ToString(CultureInfo.InvariantCulture)); Assert.AreEqual(100, (int)facets.GetSpecificValue("int", "a"), "Wrong count for category 'a'!"); Assert.AreEqual(150, (int)facets.GetSpecificValue("int", "b"), "Wrong count for category 'b'!"); }
public virtual void TestIntAndFloatAssocation() { FacetsCollector fc = new FacetsCollector(); IndexSearcher searcher = NewSearcher(reader); searcher.Search(new MatchAllDocsQuery(), fc); Facets facets = new TaxonomyFacetSumSingleAssociations("$facets.float", taxoReader, config, fc); Assert.AreEqual(50f, (float)facets.GetSpecificValue("float", "a"), 0.00001, "Wrong count for category 'a'!"); Assert.AreEqual(10f, (float)facets.GetSpecificValue("float", "b"), 0.00001, "Wrong count for category 'b'!"); facets = new TaxonomyFacetSumInt32Associations("$facets.int", taxoReader, config, fc); Assert.AreEqual(200, (int)facets.GetSpecificValue("int", "a"), "Wrong count for category 'a'!"); Assert.AreEqual(150, (int)facets.GetSpecificValue("int", "b"), "Wrong count for category 'b'!"); }