/// <summary> /// Recursively prints stats for all ordinals. </summary> public static void PrintStats(TaxonomyReader r, TextWriter @out, bool printTree) { @out.WriteLine(r.Count + " total categories."); ChildrenIterator it = r.GetChildren(TaxonomyReader.ROOT_ORDINAL); int child; while ((child = it.Next()) != TaxonomyReader.INVALID_ORDINAL) { ChildrenIterator chilrenIt = r.GetChildren(child); int numImmediateChildren = 0; while (chilrenIt.Next() != TaxonomyReader.INVALID_ORDINAL) { numImmediateChildren++; } FacetLabel cp = r.GetPath(child); @out.WriteLine("/" + cp.Components[0] + ": " + numImmediateChildren + " immediate children; " + (1 + CountAllChildren(r, child)) + " total categories"); if (printTree) { PrintAllChildren(@out, r, child, " ", 1); } } }
/// <summary> /// Sole constructor. /// </summary> protected internal IntTaxonomyFacets(string indexFieldName, TaxonomyReader taxoReader, FacetsConfig config) : base(indexFieldName, taxoReader, config) { values = new int[taxoReader.Count]; }
/// <summary> /// Aggreggates float facet values from the provided /// <see cref="ValueSource"/>, pulling ordinals using <see cref="DocValuesOrdinalsReader"/> /// against the default indexed /// facet field <see cref="FacetsConfig.DEFAULT_INDEX_FIELD_NAME"/>. /// </summary> public TaxonomyFacetSumValueSource(TaxonomyReader taxoReader, FacetsConfig config, FacetsCollector fc, ValueSource valueSource) : this(new DocValuesOrdinalsReader(FacetsConfig.DEFAULT_INDEX_FIELD_NAME), taxoReader, config, fc, valueSource) { }
/// <summary> /// Create <see cref="TaxonomyFacetSumSingleAssociations"/> against /// the specified index field. /// </summary> public TaxonomyFacetSumSingleAssociations(string indexFieldName, TaxonomyReader taxoReader, FacetsConfig config, FacetsCollector fc) : base(indexFieldName, taxoReader, config) { SumValues(fc.GetMatchingDocs()); }
/// <summary> /// Create <see cref="TaxonomyFacetSumSingleAssociations"/> against /// the default index field. /// </summary> public TaxonomyFacetSumSingleAssociations(TaxonomyReader taxoReader, FacetsConfig config, FacetsCollector fc) : this(FacetsConfig.DEFAULT_INDEX_FIELD_NAME, taxoReader, config, fc) { }
/// <summary> /// Sole constructor. /// </summary> protected SingleTaxonomyFacets(string indexFieldName, TaxonomyReader taxoReader, FacetsConfig config) : base(indexFieldName, taxoReader, config) { m_values = new float[taxoReader.Count]; }
/// <summary> /// Create <see cref="FastTaxonomyFacetCounts"/>, using the /// specified <paramref name="indexFieldName"/> for ordinals. Use /// this if you had set <see cref="FacetsConfig.SetIndexFieldName"/> /// to change the index /// field name for certain dimensions. /// </summary> public FastTaxonomyFacetCounts(string indexFieldName, TaxonomyReader taxoReader, FacetsConfig config, FacetsCollector fc) : base(indexFieldName, taxoReader, config) { Count(fc.GetMatchingDocs()); }
/// <summary> /// Create <see cref="FastTaxonomyFacetCounts"/>, which also /// counts all facet labels. /// </summary> public FastTaxonomyFacetCounts(TaxonomyReader taxoReader, FacetsConfig config, FacetsCollector fc) : this(FacetsConfig.DEFAULT_INDEX_FIELD_NAME, taxoReader, config, fc) { }
/// <summary> /// Aggreggates float facet values from the provided /// <seealso cref="ValueSource"/>, and pulls ordinals from the /// provided <seealso cref="OrdinalsReader"/>. /// </summary> public TaxonomyFacetSumValueSource(OrdinalsReader ordinalsReader, TaxonomyReader taxoReader, FacetsConfig config, FacetsCollector fc, ValueSource valueSource) : base(ordinalsReader.IndexFieldName, taxoReader, config) { this.ordinalsReader = ordinalsReader; SumValues(fc.GetMatchingDocs, fc.KeepScores, valueSource); }
/// <summary> /// Create <see cref="TaxonomyFacetCounts"/>, which also /// counts all facet labels. Use this for a non-default /// <see cref="OrdinalsReader"/>; otherwise use <see cref="FastTaxonomyFacetCounts"/>. /// </summary> public TaxonomyFacetCounts(OrdinalsReader ordinalsReader, TaxonomyReader taxoReader, FacetsConfig config, FacetsCollector fc) : base(ordinalsReader.IndexFieldName, taxoReader, config) { this.ordinalsReader = ordinalsReader; Count(fc.GetMatchingDocs()); }
/// <summary> /// Sole constructor. </summary> protected internal FloatTaxonomyFacets(string indexFieldName, TaxonomyReader taxoReader, FacetsConfig config) : base(indexFieldName, taxoReader, config) { values = new float[taxoReader.Size]; }