[hibernate-dev] Feature Proposal for Hibernate Search

Emmanuel Bernard emmanuel at hibernate.org
Mon Feb 3 16:22:41 EST 2014



> On 3 févr. 2014, at 21:57, Martin Braun <martinbraun123 at aol.com> wrote:
> > I have to admit, I am a bit skeptical on a few things:
> > - having to extend a technical class
> I am too, As stated in the e-mail before I want to get away from that design but I still
> want to be able to write queries myself if I want to. This can be done with Annotations on
> Method-Level or with QueryProviders in an extra Annotation on the Type-Level.

You lost me :)
Could you write some code, maybe in a gist.github.com ?

> > - I don't think annotations are the best way to express queries but you probably 
> > have your reasons, so let's discuss them :)
> Why? I think it's not hard to read an you have the query right with your ParameterWrapper-class which holds your data.

Indeed I like that both the query and the parameter values are hosted on the same class. And I would have the programmatic query expressed on that class. (I know it goes against my later proposal to provide params support in the DSL itself but I explore multiple routes :) ). This also solves another problem we have today of propagating the entity type to the creation of the full text query. 

But annotations in my opinion don't scale very well for tree structures. Composition, lack of polymorphism are also not easy / elegant in annotations. 
You can see that you had to break the sub queries with string references. And I am not sure how you will be able to express other query types that we have like range, spatial etc. I might be wrong, so it's worth trying. But even then, if we had one new query type, we have to also add an equivalent annotation or add new fields to an existing one. 

> > Have you explored the ability to write the query programmatically while still 
> > making use of the getter binding? I can imagine we could update the DSL to 
> > accept the parameters holder and have them injected.
> I think that would be possible, but then you would still have to handle the
> query nesting and such by hand and that code would be more complicated to use (but easier to debug, tbh).

What do you mean by query nesting by hand? And how does the annotation approach differs?

> > I wonder if literally an Example API would address your use cases ?
> What do you mean by that?
> Martin Braun
> martinbraun123 at aol.com
> www.github.com/s4ke
> 
> 
> -----Original Message-----
> From: Emmanuel Bernard <emmanuel at hibernate.org>
> To: Martin Braun <martinbraun123 at aol.com>
> Cc: hibernate-dev <hibernate-dev at lists.jboss.org>
> Sent: Mon, Feb 3, 2014 9:45 pm
> Subject: Re: [hibernate-dev] Feature Proposal for Hibernate Search
> 
> Hi Martin,
> 
> That's interesting. I have a couple of questions for you.
> 
> What is the notion of profile and when would you use it?
> 
> When do you need and use sub query ids?
> 
> The issue you had was to map getters to query parameters in an easier way than 
> currently possible, correct? It reminds me a little bit of the Example query 
> with a parameter twist. 
> 
> I have to admit, I am a bit skeptical on a few things:
> - having to extend a technical class
> - I don't think annotations are the best way to express queries but you probably 
> have your reasons, so let's discuss them :)
> 
> Have you explored the ability to write the query programmatically while still 
> making use of the getter binding? I can imagine we could update the DSL to 
> accept the parameters holder and have them injected. 
> 
> I wonder if literally an Example API would address your use cases ?
> 
> Thanks the first thoughts
> 
> Emmanuel
> 
> > On 3 févr. 2014, at 19:08, Martin Braun <martinbraun123 at aol.com> wrote:
> > 
> > 
> > Hi,
> > 
> > 
> > I am currently working on a new way to query in Hibernate Search. It's not 
> finished, but
> > it already works. I am planning on extending the functionality a lot in the 
> future and
> > I thought this could be a nice addition to Hibernate Search. What do you 
> think?
> > 
> > 
> > https://github.com/s4ke/HibernateSearchQueryExtension
> > 
> > 
> > Martin Braun
> > martinbraun123 at aol.com
> > www.github.com/s4ke
> > 
> > _______________________________________________
> > hibernate-dev mailing list
> > hibernate-dev at lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/hibernate-dev


More information about the hibernate-dev mailing list