-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Ful text search support -- Order by
PostPosted: Thu Mar 08, 2007 9:49 pm 
Senior
Senior

Joined: Tue Sep 13, 2005 2:01 am
Posts: 137
For full text search in MySQL:

select * from Book where match(title,description) against ('TV' in BOOLEAN mode) order by match(title,description) against ('TV' in BOOLEAN mode) desc

how to translate this to EJB QL or HQL, or Criteria?
The issue is "order by".

select id, match(title,description) against ('TV' in BOOLEAN mode) as value from Book where match(title,description) against ('TV' in BOOLEAN mode) order by value desc

it did not work since the "value" is replaced by automatically generated id in select, but not in order by, which makes the resultant SQL invalid. A bug?

For criteria, addOrder(Order.desc(...)) does not accept
match(title,description) against ('TV' in BOOLEAN mode)

anything like sqlOrder(...) that accepts all expressions?

Any idea is appreciated!
Dave


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 13, 2007 6:52 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
you need to use a native query, this kind of query are specific to your DB vendor

_________________
Emmanuel


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.