| 360 | | //String locale = loc.getLanguage().substring(0, 2); //only get language portion of locale |
|---|
| | 360 | //add the language-only portion of locale if its not in the list of locales already |
|---|
| | 361 | List<Locale> localesToAdd = new Vector<Locale>(); |
|---|
| | 362 | for (Locale locale : locales) { |
|---|
| | 363 | Locale languageOnly = new Locale(locale.getLanguage()); |
|---|
| | 364 | if (locales.contains(languageOnly) == false) |
|---|
| | 365 | localesToAdd.add(languageOnly); |
|---|
| | 366 | } |
|---|
| | 367 | |
|---|
| | 368 | locales.addAll(localesToAdd); |
|---|
| | 369 | |
|---|
| | 370 | //String locale = loc.getLanguage().substring(0, 2); |
|---|
| 388 | | Iterator<String> word = words.iterator(); |
|---|
| 389 | | searchCriteria.add(Expression.like("word", word.next(), MatchMode.START)); |
|---|
| 390 | | Conjunction junction = Expression.conjunction(); |
|---|
| 391 | | while (word.hasNext()) { |
|---|
| 392 | | String w = word.next(); |
|---|
| 393 | | |
|---|
| 394 | | if (log.isDebugEnabled()) |
|---|
| 395 | | log.debug("Current word: " + w); |
|---|
| 396 | | |
|---|
| 397 | | DetachedCriteria crit = DetachedCriteria.forClass(ConceptWord.class) |
|---|
| 398 | | .setProjection(Property.forName("concept")) |
|---|
| 399 | | .add(Expression.eqProperty("concept", "cw1.concept")) |
|---|
| 400 | | .add(Restrictions.like("word", w, MatchMode.START)) |
|---|
| 401 | | .add(Expression.in("locale", locales)); |
|---|
| 402 | | junction.add(Subqueries.exists(crit)); |
|---|
| 403 | | } |
|---|
| 404 | | searchCriteria.add(junction); |
|---|
| | 398 | if (words.size() > 0) { |
|---|
| | 399 | Iterator<String> word = words.iterator(); |
|---|
| | 400 | searchCriteria.add(Expression.like("word", word.next(), MatchMode.START)); |
|---|
| | 401 | Conjunction junction = Expression.conjunction(); |
|---|
| | 402 | while (word.hasNext()) { |
|---|
| | 403 | String w = word.next(); |
|---|
| | 404 | |
|---|
| | 405 | if (log.isDebugEnabled()) |
|---|
| | 406 | log.debug("Current word: " + w); |
|---|
| | 407 | |
|---|
| | 408 | DetachedCriteria crit = DetachedCriteria.forClass(ConceptWord.class) |
|---|
| | 409 | .setProjection(Property.forName("concept")) |
|---|
| | 410 | .add(Expression.eqProperty("concept", "cw1.concept")) |
|---|
| | 411 | .add(Restrictions.like("word", w, MatchMode.START)) |
|---|
| | 412 | .add(Expression.in("locale", locales)); |
|---|
| | 413 | junction.add(Subqueries.exists(crit)); |
|---|
| | 414 | } |
|---|
| | 415 | searchCriteria.add(junction); |
|---|
| | 416 | } |
|---|