|
[
Permlink
| « Hide
]
Shay Banon added a comment - 26/Jan/09 11:17 AM
Hi Kenny, can you show a code example of how the Hibernate detached query works? Also, can you post how you envision the API to look like?
Here's the relevent part of the Hibernate manual:
http://www.hibernate.org/hib_docs/v3/reference/en-US/html/querycriteria-detachedqueries.html The general point is that in Lucene, you can create a Query object without requiring a reference to the lucene runtime "entity", so from a lucene perspective there should be no reason why the compass API needs a CompassSession before creating a query. At the moment, it's easier for my application to construct Lucene-native queries, and then pass them to compass which converts them into CompassQuery before running them. It's not nice, but it's preferable in this case to the application code getting hold of a compass session in order to build the query. ok, after (some) refactoring, I think I came up with a nice solution that is basically also backward compatible and without adding more APIs to the CompassSession interface (it would have become really crowded).
Basically, you can now using Compass#queryBuilder and Compass#queryFilterBuilder (the same API, which you still have, on CompassSession). Then, once a CompassQuery created by using the Compass instance need to be used, it simply needs to be attached to a CompassSession using CompassQuery#attach(CompassSession). Note, this solution is completely thread safe, and the CompassQuery can be used in a multi threaded env. |
|||||||||||||||||||||||||||||||||||||||