database - SQL query to bring all results regardless of punctuation with JSF -


so have database articles in them , user should able search keyword input , search should find articles word in it.

so example if search word alzheimer's want return articles word spell in way regardless of apostrophe so;

alzheimer's
alzheimers

results should returned. @ minute search exact way word spell , wont bring results if has punctuation.

so have @ minute query is:

 private static final string query_find_by_search_text = "select o emailarticle o upper(o.headline) :headline or upper(o.implication) :implication or upper(o.summary) :summary"; 

and user's input called 'searchtext' comes input box.

 public static list<emailarticle> findallemailarticlesbyheadlineorsummaryorimplication(string searchtext) {     query query = entitymanager().createquery(query_find_by_search_text, emailarticle.class);        string searchtextuppercase = "%" + searchtext.touppercase() + "%";     query.setparameter("headline", searchtextuppercase);     query.setparameter("implication", searchtextuppercase);     query.setparameter("summary", searchtextuppercase);     list<emailarticle> emailarticles = query.getresultlist();     return emailarticles; } 

so bring results alzheimer's regardless of weather apostrophe or not. think have given enough information if need more say. not sure go or how it, possible replace/remove punctuation or apostrophes user search?


Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -