Lucene.Net.Facet.TestMultipleIndexFields.TestTwoCustomsSameField C# (CSharp) Method

TestTwoCustomsSameField() private method

private TestTwoCustomsSameField ( ) : void
return void
        public virtual void TestTwoCustomsSameField()
        {
            Directory indexDir = NewDirectory();
            Directory taxoDir = NewDirectory();

            // create and open an index writer
            RandomIndexWriter iw = new RandomIndexWriter(Random(), indexDir, NewIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random(), MockTokenizer.WHITESPACE, false)));
            // create and open a taxonomy writer
            var tw = new DirectoryTaxonomyWriter(taxoDir, OpenMode.CREATE);

            FacetsConfig config = Config;
            config.SetIndexFieldName("Band", "$music");
            config.SetIndexFieldName("Composer", "$music");
            seedIndex(tw, iw, config);

            IndexReader ir = iw.Reader;
            tw.Commit();

            // prepare index reader and taxonomy.
            var tr = new DirectoryTaxonomyReader(taxoDir);

            // prepare searcher to search against
            IndexSearcher searcher = NewSearcher(ir);

            FacetsCollector sfc = PerformSearch(tr, ir, searcher);

            IDictionary<string, Facets> facetsMap = new Dictionary<string, Facets>();
            Facets facets2 = GetTaxonomyFacetCounts(tr, config, sfc, "$music");
            facetsMap["Band"] = facets2;
            facetsMap["Composer"] = facets2;
            Facets facets = new MultiFacets(facetsMap, GetTaxonomyFacetCounts(tr, config, sfc));

            // Obtain facets results and hand-test them
            AssertCorrectResults(facets);

            assertOrdinalsExist("$facets", ir);
            assertOrdinalsExist("$music", ir);
            assertOrdinalsExist("$music", ir);

            IOUtils.Close(tr, ir, iw, tw, indexDir, taxoDir);
        }