Today

FacetingRequest priceFaceting = qb.facet()
            .name("price")
            .onField("ticketPrices.min")
            .range()
                .below(50)
                .from(50).to(100)
                .from(100).to(200)
                .above(200)
                .includeZeroCounts(true)
                .orderedBy(FacetSortOrder.RANGE_DEFINITION_ORDER)
            .createFacetingRequest();

would silently fail if ticketPrices.min is of Float type. It would put results in the wrong range as the Float from the index would be interpreted as an Integer.

Possible solutions:

have the Query DSL provide the boundary type to make the problem more explicit

 qb.facet()
            .name("price")
            .onField("ticketPrices.min")
            .range(Float.class) 
                .below(50) //compiler error as Integer is not Float
                .from(50).to(100) 
                .from(100).to(200) 
                .above(200)
                .includeZeroCounts(true)
                .orderedBy(FacetSortOrder.RANGE_DEFINITION_ORDER)
            .createFacetingRequest();

Have field bridge optionally publish their object type

interface TypedFieldBridge {
    Class<?> getObjectType();
}

That way, the query DSL can check for consistency and raise a runtime exception if a mismatch occurs (or even do implicit conversion?).

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira