lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chitra R <chithu.r...@gmail.com>
Subject Re: Numeric Ranges Faceting
Date Sat, 18 Feb 2017 11:33:21 GMT
Hi,

RangeFaceting computation was working fine while adding numeric Ranges in
DrillDownQuery. And this is not my issue.

My question is,

I need to compute string facets (via SortedSetDocValuesFacetCounts) using
drill sideways search by adding numeric Ranges in DrillDownQuery... This
case only throws an exception. Is it possible??


And I know, Drillsideways search retains previous level facets and its
count and it will be achieved by taking dimensions from drilldownQuery. In
my case, "price" is the dimension which was indexed as
numericDocValuesField and added in drilldownQuery. So only it was throwing
an exception when I search through drillsideways search. Am I right or
missed anything?


Kindly help me to solve my issue.

Regards,
Chitra

On Sat, Feb 18, 2017 at 4:29 PM, Michael McCandless <
lucene@mikemccandless.com> wrote:

> Hi,
>
> I think you are close!  All you need to do is make a subclass of
> DrillSideways and override the buildFacetsResults method to do the
> range faceting on your numeric dims.
>
> I just pushed an improvement to RangeFacetsExample.java showing how to
> do this: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/1e4463e3
>
> Mike McCandless
>
> http://blog.mikemccandless.com
>
>
> On Fri, Feb 17, 2017 at 11:15 AM, Chitra R <chithu.r111@gmail.com> wrote:
> > Hey,
> >             I have indexed "author","module_id" fields as
> > SortedSetDocValuesFacetField and "time", "price","salary" fields as
> > NumericDocValuesField.
> >
> > My Category looks like:
> >
> > *module_id
> >      -> author
> > *price
> >
> > module_id and price are parent categories. After selecting any one of the
> > facets from module_id, sub-category ie "author" field will be shown.
> >
> > Use-case:
> >
> > 1. I have received path values from user as "module_id:1" and "price:100
> TO
> > 500" and also need to perform drillsideways search.
> >
> > initializing drilldown query
> >
> >> DrillDownQuery drillDownQuery = new DrillDownQuery(facetsConfig,
> >> userGivenSearchQuery);
> >> drillDownQuery.add("module_id","1");
> >> drillDownQuery.add("price",NumericRangeQuery.newDoubleRange("price",
> >> 100.0, 200.0, range.minInclusive, range.maxInclusive));
> >
> >
> >  hits and facets computation
> >
> >> DrillSideways sideways = new DrillSideways(searcher, facetsConfig,
> >> docValuesReaderState);
> >> DrillSideways.DrillSidewaysResult drillResult =
> >> sideways.search(drillDownQuery, booleanFilter, null, 10, sort,
> doDocScore,
> >> doMaxScore);
> >> int totalHits = drillResult.hits.totalHits();   --> it show accurate
> total
> >> hits documents
> >> List<FacetResult> facetResult = drillResult.facets.getAllDims(10) -->
> this
> >> line throws an exception.
> >
> >
> > Exception
> >
> >>
> >>
> >>
> >> java.lang.IllegalArgumentException: dimension "price" was not indexed
> >>
> >> at
> >> org.apache.lucene.facet.sortedset.SortedSetDocValuesFacetCounts.
> getTopChildren(SortedSetDocValuesFacetCounts.java:91)
> >>
> >> at org.apache.lucene.facet.MultiFacets.getAllDims(MultiFacets.java:74)
> >
> >
> >
> > Am I did anything wrong???
> >
> >
> > Kindly post your suggestions.
> >
> > Thanks,
> > Chitra
> >
> >
> >
> > On Fri, Feb 17, 2017 at 9:11 PM, Michael McCandless
> > <lucene@mikemccandless.com> wrote:
> >>
> >> Hi, how are you instantiating your MultiFacets?  You should be passing
> >> e.g. a LongRangeFacetCounts instance for your "time" dimension, which
> >> should prevent that exception.
> >>
> >> For DrillSideways, I think you must subclass, and then override
> >> buildFacetResult to compute your range facets, because that class
> >> assumes it's either indexed facets or sorted set doc values facets.
> >>
> >> Mike McCandless
> >>
> >> http://blog.mikemccandless.com
> >>
> >>
> >> On Fri, Feb 17, 2017 at 9:14 AM, Chitra R <chithu.r111@gmail.com>
> wrote:
> >> > Any suggestions???? Kindly help me to move forward.
> >> >
> >> > Regards,
> >> > Chitra
> >> >
> >> > On Wed, Feb 15, 2017 at 9:23 PM, Chitra R <chithu.r111@gmail.com>
> wrote:
> >> >>
> >> >> Hi,
> >> >>               Thanks for the suggestion. But in the case of drill
> >> >> sideways
> >> >> search, retrieving allDimensions (using Facets.getAllDimension())
> threw
> >> >> an
> >> >> exception which is shown below...
> >> >>
> >> >> 1. While opening DocValuesReaderState, global ordinals and ordinals
> >> >> Range
> >> >> map will be computed for '$facets' field only.
> >> >> 2. NumericDocValuesField never indexes under '$ facets' so ordinal
> >> >> RangeMap will be null for the numeric field ie 'time'.
> >> >>
> >> >>>> java.lang.IllegalArgumentException: dimension "time" was not
> indexed
> >> >>>>
> >> >>>> at
> >> >>>>
> >> >>>> org.apache.lucene.facet.sortedset.SortedSetDocValuesFacetCounts.
> getTopChildren(SortedSetDocValuesFacetCounts.java:91)
> >> >>>>
> >> >>>> t org.apache.lucene.facet.MultiFacets.getAllDims(
> MultiFacets.java:74)
> >> >>
> >> >>
> >> >> In my use case,
> >> >>
> >> >> Both string pathTraversed and Numeric PathTraversedRanges will occur.
> >> >> And both faceted search and drill sideways search will be used.
> >> >>
> >> >> So how can I add path-traversed numericRanges?
> >> >>
> >> >> Am I missed anything?
> >> >>
> >> >>
> >> >> Kindly post your suggestions.
> >> >>
> >> >>
> >> >> Regards,
> >> >> Chitra
> >> >>
> >> >> On Wed, Feb 15, 2017 at 3:28 PM, Michael McCandless
> >> >> <lucene@mikemccandless.com> wrote:
> >> >>>
> >> >>> Hi, have a look at the RangeFacetsExample.java under the lucene/demo
> >> >>> module... it shows how to do this.
> >> >>>
> >> >>> Mike McCandless
> >> >>>
> >> >>> http://blog.mikemccandless.com
> >> >>>
> >> >>>
> >> >>> On Tue, Feb 14, 2017 at 12:07 PM, Chitra R <chithu.r111@gmail.com>
> >> >>> wrote:
> >> >>> > Hi,
> >> >>> >    We have planned to implement both string and numeric faceting
> >> >>> > using
> >> >>> > docvalues field.
> >> >>> >
> >> >>> > For string faceting, we have added pathtraversed dimensions
in
> >> >>> > drilldownquery. But for numeric faceting , how and where can
we
> add
> >> >>> > pathtraversed ranges during nextlevel faceted search.?
> >> >>> > And which is the better way to add pathtraversed ranges
> >> >>> > ( ie adding pathtraversed ranges in numericRangeQuery or
> >> >>> > adding pathtraversed ranges in filter).??Or Any other solution.???
> >> >>> >
> >> >>> > Thanks & Regards,
> >> >>> > Chitra
> >> >>> >
> >> >>> >
> >> >>> > Sent from my iPhone
> >> >>> >
> >> >>> > ------------------------------------------------------------
> ---------
> >> >>> > 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