<div dir="ltr">Would creating a "real" query language instead of a serialized object representation make sense then?<div><br></div><div>This would allow for a conciser syntax, making it easier to write (that's why I asked who would be writing such queries), but probably it'd be more work to create such a language. I guess a sub-set of JPQL would work for some parts, but additional elements would be needed for facets etc.</div>
<div><br></div><div style>For other applications (at least Java ones) which are creating queries programmatically it could also be an option to extend the DSL to allow for specifying the output format:</div><div style><br>
</div><div style> String query = buildQueryBuilder()</div><div style> .forEntity( Hypothesis.<span class="">class</span> )</div><div style> .get()</div><div style> .all()</div><div style> .createQuery( Format.JSON );</div>
<div style><br></div><div style> //submit query...</div><div style><br></div><div style>The DSL implementation would create an actual Lucene query, a JSON string etc., depending on the given format.</div><div style><br>
</div><div style>Not sure what makes sense, just throwing out some ideas.</div><div style><br></div><div style>--Gunnar</div><div style><br></div><div style><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">
2013/6/12 Emmanuel Bernard <span dir="ltr"><<a href="mailto:emmanuel@hibernate.org" target="_blank">emmanuel@hibernate.org</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
In the end there is always a human (so far) but think of it as used in<br>
the same way SQL is. SQL is sued by both humans and programs (ORMs).<br>
<span class="HOEnZb"><font color="#888888"><br>
Emmanuel<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
On Wed 2013-06-12 15:03, Gunnar Morling wrote:<br>
> Hi,<br>
><br>
> Just out of interest, what are the use cases for such a serialized form? Is<br>
> this intended to be written by humans or other applications?<br>
><br>
> --Gunnar<br>
><br>
><br>
><br>
><br>
> 2013/6/11 Emmanuel Bernard <<a href="mailto:emmanuel@hibernate.org">emmanuel@hibernate.org</a>><br>
><br>
> > Hey everyone,<br>
> ><br>
> > Sanne and I discussed Hibernate Search queries and serialization in<br>
> > general. I did play around that to represent Hibernate Search DSL<br>
> > queries into JSON.<br>
> ><br>
> > <a href="https://gist.github.com/emmanuelbernard/5760676" target="_blank">https://gist.github.com/emmanuelbernard/5760676</a><br>
> ><br>
> > It is a very first draft (not reviewed). What is really nice is that I did<br>
> > not have to<br>
> > do much adaptation, the Query DSL is expressive enough to have a one to<br>
> > one port thanks to its context nature.<br>
> ><br>
> > I did not work on some of the quirk cases nor tried to optimize the<br>
> > "80%" use case.<br>
> ><br>
> > A nice effect is that I manage to unify the FullTextQuery (including the<br>
> > types filtering), the lucene query part, the faceting definitions and<br>
> > the faceting selection.<br>
> ><br>
> > Let me know what you think.<br>
> > _______________________________________________<br>
> > hibernate-dev mailing list<br>
> > <a href="mailto:hibernate-dev@lists.jboss.org">hibernate-dev@lists.jboss.org</a><br>
> > <a href="https://lists.jboss.org/mailman/listinfo/hibernate-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/hibernate-dev</a><br>
> ><br>
</div></div></blockquote></div><br></div>