[hibernate-issues] [Hibernate-JIRA] Commented: (HSEARCH-770) Range facets: .below on numeric null values (AssertionFailure: Unsupported range type)

Elmer van Chastelet (JIRA) noreply at atlassian.com
Thu May 19 08:30:25 EDT 2011


    [ http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-770?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=42350#action_42350 ] 

Elmer van Chastelet commented on HSEARCH-770:
---------------------------------------------

I can think of 2 fixes at the moment:
Fix 1: in RangeFacetImpl.createNumericRangeQuery(), if range.getMin() is null -> use range.getMax, just like in .getFacetQuery(): Object minOrMax = getNonNullMinOrMax( range );
This does fix the exception problem (I just tested it), but reveals a new issue: the Facet count before narrowing include null values (that is, 6 matches before narrowing) and after narrowing null values are not included in the facet count (that is, 4 matches after narrowing) in the supplied unit test.
Fix 2: Don't include null values at all, or better: let is become a parameter just like 'includeZeroCounts'.

> Range facets: .below on numeric null values (AssertionFailure: Unsupported range type)
> --------------------------------------------------------------------------------------
>
>                 Key: HSEARCH-770
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-770
>             Project: Hibernate Search
>          Issue Type: Bug
>          Components: query
>    Affects Versions: 3.4.0.Final
>         Environment: Using Hibernate 3.4.0 final, independent on on platform.
>            Reporter: Elmer van Chastelet
>         Attachments: RangeFacetNumericNullValueFail.zip
>
>
> An assertion failure ("Unsupported range type") is thrown, when getting facets ( facetmanager.getFacets( facetName ) ) after narrowing on a facet ( facetmanager.getFacetGroup( facetingName ).selectFacets( facet )) in the following situation:
> - Using a range facet with _.below_ constraint
> - on a _numeric field_ (i.e. has @NumericField annotation)
> - the field has a _null_ value for at least one indexed entity
> Attached is a unit test that throws this exception.
> My guess is that entities with null values are included in the result of the below facet, so probably null is evaluated to be 'lower' than any valid Integer. The lowest value found is probably used somewhere to set some range during .selectFacets( facetName ). This range is then used again when calling .getFacets( facetingName ), which tries to obtain the type from a null value -> AssertionFailure: Unsupported range type.
> RangeFacetNumericNullValueFail.zip includes a unit test (testRangeBelowWithNullValues() in org.hibernate.search.test.query.facet.RangeFacetingTest) and the modified files which are used by this test (like Truck.java)
> Exception trace:
> org.hibernate.annotations.common.AssertionFailure: Unsupported range type
>    at org.hibernate.search.query.dsl.impl.RangeFacetImpl.createNumericRangeQuery(RangeFacetImpl.java:146)
>    at org.hibernate.search.query.dsl.impl.RangeFacetImpl.getFacetQuery(RangeFacetImpl.java:55)
>    at org.hibernate.search.query.engine.impl.FacetManagerImpl.createSelectionGroupQuery(FacetManagerImpl.java:160)
>    at org.hibernate.search.query.engine.impl.FacetManagerImpl.getFacetFilter(FacetManagerImpl.java:146)
>    at org.hibernate.search.query.engine.impl.HSQueryImpl.buildFilters(HSQueryImpl.java:650)
>    at org.hibernate.search.query.engine.impl.HSQueryImpl.getQueryHits(HSQueryImpl.java:384)
>    at org.hibernate.search.query.engine.impl.HSQueryImpl.queryDocumentExtractor(HSQueryImpl.java:275)
>    at org.hibernate.search.query.engine.impl.FacetManagerImpl.getFacets(FacetManagerImpl.java:110)
> See also: [topic in Hibernate user forum|https://forum.hibernate.org/viewtopic.php?f=9&t=1011030]

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list