Suneel Kumar
Suneel Kumar

Reputation: 33

Lucene.Net 4.8.0-beta00016 is throwing exception when i try to read FastTaxonomyFacetCounts from File Directory

I'm using Lucene.Net 4.8.0-beta00016 version and using .Net 6.0. When i write to RAMDirectory i'm able to fetch FastTaxonomyFacetCounts if i try to fetch from Directory (File System) it is throwing Index Corrupted. Missing parent data for category 0.

Below is the code which I'm facing issue. IndexDirectory and TaxoDirectory is the physical file path where lucene indexes generated.

using (DirectoryReader indexReader = DirectoryReader.Open(IndexDirectory))
            using (DirectoryTaxonomyReader taxoReader = new DirectoryTaxonomyReader(TaxoDirectory))
            {
                IndexSearcher searcher = new IndexSearcher(indexReader);

                FacetsCollector fc = new FacetsCollector();

                Query q = new WildcardQuery(new Term("Brand", "*Ji*"));
                TopScoreDocCollector tdc = TopScoreDocCollector.Create(10, true);

                var topDocs = FacetsCollector.Search(searcher, q, 10, fc);
                var topHits = topDocs.ScoreDocs;

                var hits = searcher.Search(q, 10, Sort.INDEXORDER).ScoreDocs;
                if (hits != null)
                {
                    foreach (var hit in hits)
                    {
                        var document = searcher.Doc(hit.Doc);
                    }
                }
                Facets facets = new FastTaxonomyFacetCounts(taxoReader, config, fc);
                var result = facets.GetAllDims(1000);

            }

If anyone has solution. Please guide me

It should return Facets.

Upvotes: 0

Views: 89

Answers (0)

Related Questions