You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by george treacy <ge...@cambia.org> on 2016/10/03 23:34:32 UTC

Faceted Search with Parallel Indexes

Hello,

I am trying to do a faceted search across two parallel indexes with a 
ParallelCompositeReader.

My problem is that I only get facet results from the first reader in the 
array of composite readers. This problem only occurs after upgrading to 
Lucene version 4_7_0+.

If I switch the order of the readers, again the first one in the array 
is the only index that gives facet results.

Regards,

-iad

CompositeReader primaryReader = 
DirectoryReader.open(FSDirectory.open((new 
File("index-directory")).toPath()));
CompositeReader suppReader = DirectoryReader.open(FSDirectory.open((new 
File("supp-directory")).toPath()));
CompositeReader[] readers = {primaryReader, suppReader};
ParallelCompositeReader pcr = new ParallelCompositeReader(readers);

FacetsCollector fc = new FacetsCollector();
TopDocs td = FacetsCollector.search(searcher, new MatchAllDocsQuery(), 
10, fc);
Directory taxoDir = FSDirectory.open((new 
File("taxonomy-directory")).toPath());
TaxonomyReader taxoReader = new DirectoryTaxonomyReader(taxoDir);
Facets facets = new FastTaxonomyFacetCounts(taxoReader, 
CujoFacetsConfig.getFacetsConfig(), fc);
List<FacetResult> results = facets.getAllDims(10);