public virtual void TestWrongIndexFieldName() { FacetsCollector fc = new FacetsCollector(); IndexSearcher searcher = NewSearcher(reader); searcher.Search(new MatchAllDocsQuery(), fc); Facets facets = new TaxonomyFacetSumFloatAssociations(taxoReader, config, fc); try { facets.GetSpecificValue("float"); Fail("should have hit exc"); } catch (System.ArgumentException) { // expected } try { facets.GetTopChildren(10, "float"); Fail("should have hit exc"); } catch (System.ArgumentException) { // expected } }
public virtual void TestFloatSumAssociation() { FacetsCollector fc = new FacetsCollector(); IndexSearcher searcher = NewSearcher(reader); searcher.Search(new MatchAllDocsQuery(), fc); Facets facets = new TaxonomyFacetSumFloatAssociations("$facets.float", taxoReader, config, fc); Assert.AreEqual("dim=float path=[] value=-1.0 childCount=2\n a (50.0)\n b (9.999995)\n", facets.GetTopChildren(10, "float").ToString()); 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'!"); }
public virtual void TestIntAndFloatAssocation() { FacetsCollector fc = new FacetsCollector(); IndexSearcher searcher = NewSearcher(reader); searcher.Search(new MatchAllDocsQuery(), fc); Facets facets = new TaxonomyFacetSumFloatAssociations("$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 TaxonomyFacetSumIntAssociations("$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'!"); }