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: DrillSideways accepting FacetCollector parameter
Date Mon, 14 Jul 2014 07:25:53 GMT
Ok, i have overriden buildFacetsResult(...) method like below, Its just
adding additional numericFacets to MultiFacets collection.

protected Facets buildFacetsResult(final FacetsCollector drillDowns, final
FacetsCollector[] drillSideways,
            final String[] drillSidewaysDims) {
Facets drillDownFacets = new FastTaxonomyFacetCounts(taxoReader, config,
drillDowns);
Map<String, Facets> multiFacets = new HashMap<>();
if (drillSideways != null) {
            for (int i = 0; i < drillSideways.length; i++) {
                multiFacets.put(drillSidewaysDims[i], new
FastTaxonomyFacetCounts(taxoReader, config, drillSideways[i]));
            }
}
...
Facets numericFacets = new LongRangeFacetCounts("wordcount", drillDowns,
                        longRanges.toArray(new
LongRange[longRanges.size()]));
...
multiFacets.put("wordcount", numericFacets);
...
return new MultiFacets(multiFacets, drillDownFacets);
}

So, initialize dynamic range facets like  'LongRangeFacetCounts' in
overridden method, is fine ?




On Wed, Jul 9, 2014 at 3:22 PM, Michael McCandless <
lucene@mikemccandless.com> wrote:

> Ahh I see, for this use case you should just subclass DrillSideways
> and override the buildFacetResult method?  That method gets the drill
> down and all sideways collectors...
>
> Mike McCandless
>
> http://blog.mikemccandless.com
>
>
> On Wed, Jul 9, 2014 at 1:40 AM, Jigar Shah <jigaronline@gmail.com> wrote:
> > Usecase:
> >
> > With below code i perform search.
> >
> > DrillSideways drillSideWays = new DrillSideways(searcher, config,
> > engine.getTaxoReader());
> > DrillSidewaysResult result = drillSideWays.search(filterQuery, null,
> null,
> > first + limit, sort, true, true);
> >
> > In above code i don't have reference to FacetCollector fc, which is used.
> > Consider i want to get LongRangeFacetCounts, which is based on
> > NumericDocValuesField.
> >
> > facets = new LongRangeFacetCounts(facetField.getQueryName(), fc,
> > longRanges.toArray(new LongRange[longRanges
> >                             .size()]));
> >
> > if i use below, i get access to current fc.
> >
> > FacetsCollector fc = new FacetsCollector();
> > TopDocs topDocs = FacetsCollector.search(searcher, query, null, first +
> > limit, sort, true, true, fc);
> >
> > Difference is if i use ' FacetsCollector.search(searcher, query, null,
> > first + limit, sort, true, true, fc);' i can get FacetCollector. This is
> > not true in case of DrillSideways.
> >
> > Let me know if, there is already some other way provided.
> >
> > Thanks,
> > Jigar Shah.
> >
> >
> >
> >
> >
> >
> > On Tue, Jul 8, 2014 at 8:15 PM, Michael McCandless <
> > lucene@mikemccandless.com> wrote:
> >
> >> We could do this, but what's the use case?
> >>
> >> E.g. DrillSideways also "hardwires" the drill-sideways collectors it
> >> creates ... do you control over those as well?  Maybe we could make
> >> methods in the DrillSideways class that you could override?
> >>
> >> Mike McCandless
> >>
> >> http://blog.mikemccandless.com
> >>
> >>
> >> On Tue, Jul 8, 2014 at 7:14 AM, Jigar Shah <jigaronline@gmail.com>
> wrote:
> >> > Currently Drillsideways provides following method:
> >> >
> >> > public DrillSidewaysResult search(DrillDownQuery query, Collector
> >> > hitCollector);
> >> >
> >> > Can same class provide following method ?
> >> >
> >> > public DrillSidewaysResult search(DrillDownQuery query, Collector
> >> > hitCollector, FacetsCollector facetCollector);
> >> >
> >> > Currently,
> >> >
> >> >  FacetsCollector drillDownCollector = new FacetsCollector();
> >> >
> >> > is created from API method
> >> >
> >> > public DrillSidewaysResult search(DrillDownQuery query, Collector
> >> > hitCollector) throws IOException
> >> >
> >> >  which can be parametrised ?
> >> >
> >> > It will help application to use same FacetsCollector to fetch other
> >> facets,
> >> > i.e. non sideways facets.
> >> >
> >> > Thanks,
> >> > Jigar Shah.
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> >> For additional commands, e-mail: java-user-help@lucene.apache.org
> >>
> >>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>

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