lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jigar Shah <jigaronl...@gmail.com>
Subject Re: Lucene Facets Module 4.8.1
Date Sat, 21 Jun 2014 05:08:47 GMT
Thanks for helping me.

Yes, i did couple of things:

Below is simple code for indexing which i use.

TrackingIndexWriter nrtWriter
DirectoryTaxonomyWriter taxoWriter = ...
....
FacetsConfig config = new FacetConfig();
config.setHierarchical("CITY", true)
config.setMultiValued("CITY", true);
config.setIndexFieldName("CITY","city") // I kept dimName different from
indexFieldName
....
Added indexing searchable fields...
....

doc.add( new FacetField("CITY", "India", "Gujarat", "Vadodara" ))
doc.add( new FacetField("CITY", "India", "Gujarat", "Ahmedabad" ))

 nrtWriter.addDocument(config.build(taxoWriter, doc));

Below is code which i use for searching

TaxonomyReader taxoReader = new DirectoryTaxonomyReader(taxoWriter);

Query query = ...
IndexSearcher searcher = ...
DrillDownQuery ddq = new DrillDownQuery(config, query);
DrillSideways ds = new DrillSideways(searcher, config, taxoReader); //
Config object is same which i created before
DrillSidewaysResult result = ds.search(query, null, null, start + limit,
null, true, true)
...
Facets f = result.facets
FacetResult fr = f.getTopChildren(5, "CITY") [Exception is geneated]//
Didn't perform any drill-down,really, its just original query for first
time, but wrapped in DrillDownQuery.

... and below gives me empty collection.

List<FacetResult> frs= f.getAllDims(5)

I debug source code and found, it internally calls

FastTaxonomyFacetCounts(indexFieldName, taxoReader, config) // Config
object is same which i created before

which then calls

IntTaxonomyFacets(indexFieldName, taxoReader, config) // Config object is
same which i created before

And during this calls the value of indexFieldName is "$facets defined by
constant  'public static final String DEFAULT_INDEX_FIELD_NAME = "$facets";'
in FacetsConfig.

My question is if i am using same FacetsConfig while indexing and
searching. why its not identifying correct name of field, and goes for
"$facets"

Please correct me if i understood wrong. or correct way to solve above
problem.

Many Thanks.
Jigar Shah.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message