It should be possible to search for keywords even if the keyword does not start with the specific search term.

This commit is contained in:
Tom Vahlman 2012-03-20 12:31:30 +01:00
parent c49ff3141a
commit 8b5fd352e3

@ -138,14 +138,13 @@ public class KeywordDaoJPAImp extends LazyDeleteAbstractDaoJPAImp<Keyword> imple
}
@Override
// TODO should be improved so that it is possible to search on "mining" and find "data mining"
public List<Keyword> getAutoCompleteCapableSupervisors(final KeywordType keywordType, final String keywordName) {
return getJpaTemplate().execute(new JpaCallback<List<Keyword>>() {
public List<Keyword> doInJpa(EntityManager em) throws PersistenceException {
TypedQuery<Keyword> query;
query = em.createQuery("SELECT x FROM "+domainClassString+" x WHERE x.type = :type AND x.keyword LIKE :keywordName ORDER BY keyword", domainClass);
query.setParameter("type", keywordType);
String keyWordNameString = keywordName + "%";
String keyWordNameString = "%" + keywordName + "%";
query.setParameter("keywordName", keyWordNameString);
query.setHint(QueryHints.HINT_CACHEABLE, "true");
return query.getResultList();