From ed9e9c09824c32466bfb82f4df21af843cba0268 Mon Sep 17 00:00:00 2001 From: dubtraxis Date: Tue, 21 Oct 2003 18:32:39 +0000 Subject: [PATCH] Fixed search modes exact, startsWith, and anywhere. --- src/java/org/thdl/lex/LexComponentRepository.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/java/org/thdl/lex/LexComponentRepository.java b/src/java/org/thdl/lex/LexComponentRepository.java index 447dae2..6b70a90 100644 --- a/src/java/org/thdl/lex/LexComponentRepository.java +++ b/src/java/org/thdl/lex/LexComponentRepository.java @@ -58,7 +58,6 @@ public class LexComponentRepository - /** * Sets the start attribute of the LexComponentRepository object * @@ -218,17 +217,17 @@ public class LexComponentRepository String termForQuery = null; if ( lexQuery.getFindMode().equals( LexComponentRepository.EXACT ) ) { - termForQuery = "'" + term.getTerm() + "'"; + termForQuery = term.getTerm(); } else if ( lexQuery.getFindMode().equals( LexComponentRepository.STARTS_WITH ) ) { - termForQuery = "'" + term.getTerm() + "%'"; + termForQuery = term.getTerm() + "%"; } else if ( lexQuery.getFindMode().equals( LexComponentRepository.ANYWHERE ) ) { - termForQuery = "'%" + term.getTerm() + "%'"; + termForQuery = "%" + term.getTerm() + "%"; } - String queryString = " FROM org.thdl.lex.component.ITerm as term WHERE term.term like '" + term.getTerm() + "%' AND term.deleted=0 ORDER BY term.term"; + String queryString = " FROM org.thdl.lex.component.ITerm as term WHERE term.term like '" + termForQuery + "' AND term.deleted=0 ORDER BY term.term"; try { query = getSession().createQuery( queryString );