[hibernate-dev] [HSearch] Faceting feedback

Emmanuel Bernard emmanuel at hibernate.org
Tue Mar 1 11:34:58 EST 2011


On 1 mars 2011, at 15:08, Hardy Ferentschik wrote:

> Thanks for the feedback. Answers inline
> 
> On Tue, 01 Mar 2011 14:39:58 +0100, Emmanuel Bernard <emmanuel at hibernate.org> wrote:
> 
>> To avoid the problem of Constructor multiplications and still use immutable objects use a builder to collect the information and create the object out of it. The constructor can even be package private
> 
> I guess that the third alternative. If I remember right that is also a pattern
> described in "Effective Java". I am mainly wondering what it really gives me
> to make these objects immutable.

Life fulfillment.

>> FacetRequest request =
>> carBuilder
>>  .facet()
>>    .named("prices")
>>    .range() //or should it be range(Integer.class)
>>    .onField("price")
>>    .from(0).to(1000).excludeLimit()
>>    .from(1000).to(1500).excludeLimit()
>>    .above(1500)
>>    .orderedBy(FIELD_VALUE);
>> 
>> query.enableFacet(request);
> 
> Got you. This brings up another question. Should we only have this DSL based approach or should we
> keep also have the current programmatic approach. If we keep it all we end could end up
> with annotation, DSL and "standard programmatic" versions of the API

I see the DSL as a better approach for the programmatic API, not an alternative. We would keep the underlying API private to us basically. 
Do you think that make sense?



More information about the hibernate-dev mailing list