OK I see. I think the code works OK though. It documents that you should
call the other constructor if you specify a custom indexFieldName for some
of the dimensions.

Currently if you index dimensions under different indexFieldNames, you
should initialize a FacetsCounts per indexFieldName. There's no way for the
default ctor of FastTaxonomyFacetCounts to determine which indexFieldName
to use as it doesn't know which dimensions you're going to ask to count.

Hope that helps.

Shai


On Sun, Jun 22, 2014 at 4:05 PM, Jigar Shah <jigaronl...@gmail.com> wrote:

> I will try to dig more on your suggestions, and also assert FacetsConfig
> object.
>
> While debugging i found, buildFacetsResult(...) method from
> DrillSideways.java
>
> Its internally invoking following constructor from
> FastTaxonomyFacetCounts.java
>
> FastTaxonomyFacetCounts() {
>     this(FacetsConfig.DEFAULT_INDEX_FIELD_NAME, taxoReader, config, fc); //
> FacetsConfig.DEFAULT_INDEX_FIELD_NAME is '$facets'
> }
>
> Shouldn't it invoke following constructor with correct indexFieldName ? In
> my case indexFieldName as 'city' which has dimension 'CITY'.
>
>  FastTaxonomyFacetCounts(String indexFieldName, TaxonomyReader taxoReader,
> FacetsConfig config, FacetsCollector fc) throws IOException {
>     super(indexFieldName, taxoReader, config);
>     ...
> }
>
> Thanks
> Jigar Shah.
>
>
>
> On Sat, Jun 21, 2014 at 11:01 PM, Shai Erera <ser...@gmail.com> wrote:
>
> > If you can, while in debug mode try to note the instance ID of the
> > FacetsConfig, and assert it is indeed the same (i.e. indexConfig ==
> > searchConfig).
> >
> > Shai
> >
> >
> > On Sat, Jun 21, 2014 at 8:26 PM, Michael McCandless <
> > luc...@mikemccandless.com> wrote:
> >
> > > Are you sure it's the same FacetsConfig at search time?  Because the
> > > exception implies your CITY field didn't have
> > > config.setIndexFieldName("CITY", "city") called.
> > >
> > > Or, can you try commenting out 'config.setIndexFieldName("CITY",
> > > "city")' at index time and see if the exception still happens?
> > >
> > > Mike McCandless
> > >
> > > http://blog.mikemccandless.com
> > >
> > >
> > > On Sat, Jun 21, 2014 at 1:08 AM, Jigar Shah <jigaronl...@gmail.com>
> > wrote:
> > > > 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.
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
> > > For additional commands, e-mail: java-user-h...@lucene.apache.org
> > >
> > >
> >
>

Reply via email to