List of usage examples for org.apache.lucene.analysis.th ThaiAnalyzer ThaiAnalyzer
public ThaiAnalyzer()
From source file:de.mirkosertic.desktopsearch.AnalyzerCache.java
License:Open Source License
public AnalyzerCache(Configuration aConfiguration) { standardAnalyzer = configure(new StandardAnalyzer()); analyzerByLanguage = new HashMap<>(); registerIfEnabled(SupportedLanguage.ar, aConfiguration, configure(new ArabicAnalyzer())); registerIfEnabled(SupportedLanguage.bg, aConfiguration, configure(new BulgarianAnalyzer())); registerIfEnabled(SupportedLanguage.br, aConfiguration, configure(new BrazilianAnalyzer())); registerIfEnabled(SupportedLanguage.ca, aConfiguration, configure(new CatalanAnalyzer())); registerIfEnabled(SupportedLanguage.ckb, aConfiguration, configure(new SoraniAnalyzer())); registerIfEnabled(SupportedLanguage.cz, aConfiguration, configure(new CzechAnalyzer())); registerIfEnabled(SupportedLanguage.da, aConfiguration, configure(new DanishAnalyzer())); registerIfEnabled(SupportedLanguage.de, aConfiguration, configure(new GermanAnalyzer())); registerIfEnabled(SupportedLanguage.el, aConfiguration, configure(new GreekAnalyzer())); registerIfEnabled(SupportedLanguage.en, aConfiguration, configure(new EnglishAnalyzer())); registerIfEnabled(SupportedLanguage.es, aConfiguration, configure(new SpanishAnalyzer())); registerIfEnabled(SupportedLanguage.eu, aConfiguration, configure(new BasqueAnalyzer())); registerIfEnabled(SupportedLanguage.fa, aConfiguration, configure(new PersianAnalyzer())); registerIfEnabled(SupportedLanguage.fi, aConfiguration, configure(new FinnishAnalyzer())); registerIfEnabled(SupportedLanguage.fr, aConfiguration, configure(new FrenchAnalyzer())); registerIfEnabled(SupportedLanguage.ga, aConfiguration, configure(new IrishAnalyzer())); registerIfEnabled(SupportedLanguage.gl, aConfiguration, configure(new GalicianAnalyzer())); registerIfEnabled(SupportedLanguage.hi, aConfiguration, configure(new HindiAnalyzer())); registerIfEnabled(SupportedLanguage.hu, aConfiguration, configure(new HungarianAnalyzer())); registerIfEnabled(SupportedLanguage.hy, aConfiguration, configure(new ArmenianAnalyzer())); registerIfEnabled(SupportedLanguage.id, aConfiguration, configure(new IndonesianAnalyzer())); registerIfEnabled(SupportedLanguage.it, aConfiguration, configure(new ItalianAnalyzer())); registerIfEnabled(SupportedLanguage.lv, aConfiguration, configure(new LatvianAnalyzer())); registerIfEnabled(SupportedLanguage.nl, aConfiguration, configure(new DutchAnalyzer())); registerIfEnabled(SupportedLanguage.no, aConfiguration, configure(new NorwegianAnalyzer())); registerIfEnabled(SupportedLanguage.pt, aConfiguration, configure(new PortugueseAnalyzer())); registerIfEnabled(SupportedLanguage.ro, aConfiguration, configure(new RomanianAnalyzer())); registerIfEnabled(SupportedLanguage.ru, aConfiguration, configure(new RussianAnalyzer())); registerIfEnabled(SupportedLanguage.sv, aConfiguration, configure(new SwedishAnalyzer())); registerIfEnabled(SupportedLanguage.th, aConfiguration, configure(new ThaiAnalyzer())); registerIfEnabled(SupportedLanguage.tr, aConfiguration, configure(new TurkishAnalyzer())); }
From source file:lucee.runtime.search.lucene2.SearchUtil.java
License:Open Source License
public static Analyzer getAnalyzer(String language) throws SearchException { if (language == null) language = "english"; else//from w ww . jav a2 s .c o m language = language.toLowerCase().trim(); language = lucee.runtime.search.SearchUtil.translateLanguage(language); Analyzer analyzer = analyzers.get(language); if (analyzer != null) return analyzer; if (language.equals("english")) analyzer = new StandardAnalyzer(); else if (language.equals("german")) analyzer = new GermanAnalyzer(); else if (language.equals("russian")) analyzer = new RussianAnalyzer(); else if (language.equals("dutch")) analyzer = new DutchAnalyzer(); else if (language.equals("french")) analyzer = new FrenchAnalyzer(); else if (language.equals("norwegian")) analyzer = new NorwegianAnalyzer(); else if (language.equals("portuguese")) analyzer = new PortugueseAnalyzer(); else if (language.equals("spanish")) analyzer = new SpanishAnalyzer(); else if (language.equals("brazilian")) analyzer = new BrazilianAnalyzer(); else if (language.equals("chinese")) analyzer = new ChineseAnalyzer(); else if (language.startsWith("czech")) analyzer = new CzechAnalyzer(); else if (language.equals("greek")) analyzer = new GreekAnalyzer(); else if (language.equals("thai")) analyzer = new ThaiAnalyzer(); else if (language.equals("japanese")) analyzer = new CJKAnalyzer(); else if (language.equals("korean")) analyzer = new CJKAnalyzer(); else if (language.equals("italian")) analyzer = new ItalianAnalyzer(); else if (language.equals("danish")) analyzer = new DanishAnalyzer(); else if (language.equals("norwegian")) analyzer = new NorwegianAnalyzer(); else if (language.equals("finnish")) analyzer = new SnowballAnalyzer("Finnish"); else if (language.equals("swedish")) analyzer = new SnowballAnalyzer("Swedish"); else { String clazzName = "org.apache.lucene.analysis.el." + StringUtil.ucFirst(language.trim().toLowerCase()) + "Analyzer;"; Object o = ClassUtil.loadInstance(clazzName, (Object) null); if (o == null) { clazzName = "lucee.runtime.search.lucene2.analyzer." + StringUtil.ucFirst(language.trim().toLowerCase()) + "Analyzer"; o = ClassUtil.loadInstance(clazzName, (Object) null);//Class.orName(clazzName).newInstance(); } if (o instanceof Analyzer) analyzer = (Analyzer) o; else if (o == null) throw new SearchException("can't create Language Analyzer for Lanuage " + language + ", make Analyzer [" + clazzName + "] available"); else throw new SearchException("can't create Language Analyzer for Lanuage " + language + ", Analyzer [" + clazzName + "] is of invalid type"); } analyzers.put(language, analyzer); return analyzer; }
From source file:org.apache.jsp.results_jsp.java
License:Apache License
public void _jspService(final javax.servlet.http.HttpServletRequest request, final javax.servlet.http.HttpServletResponse response) throws java.io.IOException, javax.servlet.ServletException { final java.lang.String _jspx_method = request.getMethod(); if (!"GET".equals(_jspx_method) && !"POST".equals(_jspx_method) && !"HEAD".equals(_jspx_method) && !javax.servlet.DispatcherType.ERROR.equals(request.getDispatcherType())) { response.sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED, "JSPs only permit GET POST or HEAD"); return;//from ww w .java2 s .c o m } final javax.servlet.jsp.PageContext pageContext; javax.servlet.http.HttpSession session = null; final javax.servlet.ServletContext application; final javax.servlet.ServletConfig config; javax.servlet.jsp.JspWriter out = null; final java.lang.Object page = this; javax.servlet.jsp.JspWriter _jspx_out = null; javax.servlet.jsp.PageContext _jspx_page_context = null; try { response.setContentType("text/html;charset=UTF-8"); pageContext = _jspxFactory.getPageContext(this, request, response, null, true, 8192, true); _jspx_page_context = pageContext; application = pageContext.getServletContext(); config = pageContext.getServletConfig(); session = pageContext.getSession(); out = pageContext.getOut(); _jspx_out = out; out.write("<!--\r\n"); out.write(" Licensed to the Apache Software Foundation (ASF) under one or more\r\n"); out.write(" contributor license agreements. See the NOTICE file distributed with\r\n"); out.write(" this work for additional information regarding copyright ownership.\r\n"); out.write(" The ASF licenses this file to You under the Apache License, Version 2.0\r\n"); out.write(" the \"License\"); you may not use this file except in compliance with\r\n"); out.write(" the License. You may obtain a copy of the License at\r\n"); out.write(" \r\n"); out.write(" http://www.apache.org/licenses/LICENSE-2.0\r\n"); out.write(" \r\n"); out.write(" Unless required by applicable law or agreed to in writing, software\r\n"); out.write(" distributed under the License is distributed on an \"AS IS\" BASIS,\r\n"); out.write(" WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n"); out.write(" See the License for the specific language governing permissions and\r\n"); out.write(" limitations under the License.\r\n"); out.write(" -->\r\n"); out.write(" \r\n"); out.write(" \r\n"); out.write("\r\n"); out.write(" "); out.write("\r\n"); out.write( " <div style=\" position:fixed ;width:1600px; background-color:#C0C0C0; top:0%; left:0%; height:130px\" >\r\n"); out.write(" <div style=\" float: left; width: 200px; overflow: hidden; height:110px;\">\r\n"); out.write(" \r\n"); out.write(" </div>\r\n"); out.write(" <div>\r\n"); out.write(" <a href=\"/luceneweb\">\r\n"); out.write( " <img src = \"Logo2.jpg\" style=\"float: left; margin-top: 20px;\" width=\"180px\" height=\"60px\" align=\"middle\"/>\r\n"); out.write(" </a>\r\n"); out.write(" </div>\r\n"); out.write(" <div style=\" float: left; width: 50px; overflow: hidden; height:110px;\">\r\n"); out.write(" \r\n"); out.write(" </div>\r\n"); out.write( " <form name=\"search\" action=\"results.jsp\" method=\"get\" style=\" float: none; width: auto; overflow: hidden; height:130px\">\r\n"); out.write(" <div>\r\n"); out.write(" <p>\r\n"); out.write( " <input name=\"query\" size=\"44\" placeholder=\"Type your document here...\"/> \r\n"); out.write(" <input type=\"submit\" value=\"Search\"/>\r\n"); out.write(" \r\n"); out.write(" </p>\r\n"); out.write(" <p>\r\n"); out.write(" Search method\r\n"); out.write(" <div >\r\n"); out.write( " <input type=\"radio\" name=\"type_search\" value=\"Pagerank\" id=\"option1\" autocomplete=\"off\" > Pagerank\r\n"); out.write( " <input type=\"radio\" name=\"type_search\" value=\"Rerank\" id=\"option2\" autocomplete=\"off\"> Rerank\r\n"); out.write( " <input type=\"radio\" name=\"type_search\" value=\"Random\" id=\"option3\" autocomplete=\"off\"> Random\r\n"); out.write( " <input name=\"maxresults\" size=\"4\" value=\"10\"/> Results Per Page \r\n"); out.write(" </div>\r\n"); out.write(" <br></br>\r\n"); out.write(" </p>\r\n"); out.write(" </div>\r\n"); out.write(" </form>\r\n"); out.write(" </div>\r\n"); out.write(" <div style=\"height:130px\"></div>\r\n"); out.write(" "); String search_option_old = request.getParameter("type_search"); out.write("\r\n"); out.write(" <script>myval =\""); out.print(search_option_old); out.write("\";</script>\r\n"); out.write(" <script type=\"text/javascript\">\r\n"); out.write(" function getCookie (cname) {\r\n"); out.write(" let name = cname + '='\r\n"); out.write(" let decodedCookie = decodeURIComponent(document.cookie)\r\n"); out.write(" let ca = decodedCookie.split(';')\r\n"); out.write(" for (let i = 0; i < ca.length; i++) {\r\n"); out.write(" let c = ca[i]\r\n"); out.write(" while (c.charAt(0) === ' ') {\r\n"); out.write(" c = c.substring(1)\r\n"); out.write(" }\r\n"); out.write(" if (c.indexOf(name) === 0) {\r\n"); out.write(" return c.substring(name.length, c.length)\r\n"); out.write(" }\r\n"); out.write(" }\r\n"); out.write(" return ''\r\n"); out.write(" }\r\n"); out.write(" </script>\r\n"); out.write(" <script type=\"text/javascript\">\r\n"); out.write(" if (myval === null) {\r\n"); out.write(" myval = getCookie(\"option\")\r\n"); out.write(" } else if (myval === 'Pagerank' || myval === 'Random' || myval === 'Rerank'){\r\n"); out.write( " document.cookie = 'option=' + myval + '; expires=Thu, 18 Dec 2018 12:00:00 UTC; path=/';\r\n"); out.write(" console.log(getCookie('option'))\r\n"); out.write(" }\r\n"); out.write("\r\n"); out.write(" if (myval == 'Pagerank') {\r\n"); out.write(" document.getElementById('option1').checked = true;\r\n"); out.write(" } else if (myval == 'Rerank') {\r\n"); out.write(" document.getElementById('option2').checked = true;\r\n"); out.write(" } else if(myval =='Random') {\r\n"); out.write(" document.getElementById('option3').checked = true;\r\n"); out.write(" }\r\n"); out.write(" else {\r\n"); out.write(" myval = getCookie('option')\r\n"); out.write(" console.log(myval)\r\n"); out.write(" if (myval == 'Pagerank'){\r\n"); out.write(" document.getElementById('option1').checked = true;\r\n"); out.write(" } else if(myval =='Rerank') {\r\n"); out.write(" document.getElementById('option2').checked = true;\r\n"); out.write(" } else if(myval =='Random') {\r\n"); out.write(" document.getElementById('option3').checked = true;\r\n"); out.write(" }\r\n"); out.write(" }\r\n"); out.write(" </script>\r\n"); out.write(" "); out.write("<!--\n"); out.write(" Licensed to the Apache Software Foundation (ASF) under one or more\n"); out.write(" contributor license agreements. See the NOTICE file distributed with\n"); out.write(" this work for additional information regarding copyright ownership.\n"); out.write(" The ASF licenses this file to You under the Apache License, Version 2.0\n"); out.write(" the \"License\"); you may not use this file except in compliance with\n"); out.write(" the License. You may obtain a copy of the License at\n"); out.write(" \n"); out.write(" http://www.apache.org/licenses/LICENSE-2.0\n"); out.write(" \n"); out.write(" Unless required by applicable law or agreed to in writing, software\n"); out.write(" distributed under the License is distributed on an \"AS IS\" BASIS,\n"); out.write(" WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n"); out.write(" See the License for the specific language governing permissions and\n"); out.write(" limitations under the License.\n"); out.write(" -->\n"); out.write("<!--\n"); out.write(" Licensed to the Apache Software Foundation (ASF) under one or more\n"); out.write(" contributor license agreements. See the NOTICE file distributed with\n"); out.write(" this work for additional information regarding copyright ownership.\n"); out.write(" The ASF licenses this file to You under the Apache License, Version 2.0\n"); out.write(" the \"License\"); you may not use this file except in compliance with\n"); out.write(" the License. You may obtain a copy of the License at\n"); out.write(" \n"); out.write(" http://www.apache.org/licenses/LICENSE-2.0\n"); out.write(" \n"); out.write(" Unless required by applicable law or agreed to in writing, software\n"); out.write(" distributed under the License is distributed on an \"AS IS\" BASIS,\n"); out.write(" WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n"); out.write(" See the License for the specific language governing permissions and\n"); out.write(" limitations under the License.\n"); out.write(" -->\n"); /* Author: Andrew C. Oliver (acoliver2@users.sourceforge.net) */ String appTitle = "Monday Saturday Search"; /* make sure you point the below string to the index you created with IndexHTML */ String indexLocation = "W:\\Program\\eclipse\\WorkSpace\\Lucene\\index"; String appfooter = "Apache Lucene Template WebApp 1.0"; out.write('\n'); out.write('\n'); out.write('\n'); /* Author: Andrew C. Oliver (acoliver2@users.sourceforge.net */ out.write("\n"); out.write("<html>\n"); out.write("<head>\n"); out.write("\t<title>"); out.print(appTitle); out.write("</title>\n"); out.write("</head>\n"); out.write("<body>\n"); out.write("\n"); out.write("<p align=\"center\">\n"); out.write("\n"); out.write(" </div>\n"); out.write("</p>\n"); out.write('\r'); out.write('\n'); out.write(' '); boolean error = false; //used to control flow for error messages String indexName = indexLocation; //local copy of the configuration variable IndexSearcher searcher = null; //the searcher used to open/search the index Query query = null; //the Query created by the QueryParser TopDocs hits = null; //the search results int startindex = 0; //the first index displayed on this page int maxpage = 50; //the maximum items displayed on this page String queryString = null; //the query entered in the previous page String startVal = null; //string version of startindex String maxresults = null; //string version of maxpage int thispage = 0; //used for the for/next either maxpage or //hits.totalHits - startindex - whichever is String search_option = ""; //less try { IndexReader reader = DirectoryReader.open(FSDirectory.open(Paths.get(indexName))); searcher = new IndexSearcher(reader); } catch (Exception e) { out.write("\r\n"); out.write(" <p>ERROR opening the Index - contact sysadmin!</p>\r\n"); out.write(" <p>Error message: "); out.print(escapeHTML(e.getMessage())); out.write("</p> \r\n"); out.write(" "); error = true; //don't do anything up to the footer } out.write('\r'); out.write('\n'); out.write(' '); if (error == false) { //did we open the index? //queryString = URLDecoder.decode(request.getParameter("query"),"UTF-8"); //get the search criteria queryString = request.getParameter("query"); //get the search criteria startVal = request.getParameter("startat"); //get the start index maxresults = request.getParameter("maxresults"); //get max results per page search_option = request.getParameter("type_search"); try { maxpage = Integer.parseInt(maxresults); //parse the max results first startindex = Integer.parseInt(startVal); //then the start index } catch (Exception e) { } //we don't care if something happens we'll just start at 0 //or end at 50 if (queryString == null) throw new ServletException("no query " + //if you don't have a query then "specified"); //you probably played on the //query string so you get the //treatment //Analyzer analyzer = new StandardAnalyzer(Version.LUCENE_CURRENT); //construct our usual analyzer Analyzer analyzer = new ThaiAnalyzer(); try { QueryParser qp = new QueryParser("contents", analyzer); query = qp.parse(queryString.trim()); //parse the } catch (ParseException e) { //query and construct the Query //object //if it's just "operator error" //send them a nice error HTML out.write("\r\n"); out.write(" <p>Error while parsing query: "); out.print(escapeHTML(e.getMessage())); out.write("</p>\r\n"); out.write(" "); error = true; //don't bother with the rest of //the page } } out.write('\r'); out.write('\n'); out.write(' '); if (error == false && searcher != null) { // if we've had no errors // searcher != null was to handle // a weird compilation bug thispage = maxpage; // default last element to maxpage hits = searcher.search(query, 10000 + startindex); // run the query if (hits.totalHits == 0) { // if we got no results tell the user out.write("\r\n"); out.write(" <p> I'm sorry I couldn't find what you were looking for. </p>\r\n"); out.write(" "); error = true; // don't bother with the rest of the // page } } if (error == false && searcher != null) { out.write("\r\n"); out.write(" <div class=\"row\" style=\"float:right; width : 85%; left: 15%\">\r\n"); out.write(" <td></td><td>Number of total page : "); out.print(hits.totalHits); out.write("</td>\r\n"); out.write(" </div>\r\n"); out.write(" <div class=\"row\" style=\"float:right; width : 85%; left: 15%\">\r\n"); out.write(" <table >\r\n"); out.write(" "); if ((startindex + maxpage) > hits.totalHits) { thispage = hits.totalHits - startindex; // set the max index to maxpage or last } // actual search result whichever is less float alpha = 0.65f; class NewRank { float Page_Rank; float Re_Rank; float Sim_Rank; Document Doc; double score; } ; NewRank[] ranking = new NewRank[hits.totalHits]; for (int i = startindex; i < (hits.totalHits); i++) { Document doc = searcher.doc(hits.scoreDocs[i].doc); float sim = hits.scoreDocs[i].score; float pagerank = 0.0f; try { pagerank = Float.parseFloat(doc.get("PageRank")); } catch (Exception e) { //out.println("An exception occurred: " + e.getMessage()); } ranking[i] = new NewRank(); ranking[i].Page_Rank = pagerank; ranking[i].Re_Rank = pagerank * (1 - alpha) + sim * alpha; ranking[i].Sim_Rank = sim; ranking[i].Doc = doc; } //out.print(search_option); //out.print(search_option.equals("Pagerank")); try { if (search_option.equals("Pagerank")) { //out.print("1"); Arrays.sort(ranking, new Comparator<NewRank>() { public int compare(NewRank n1, NewRank n2) { return Float.compare(n2.Page_Rank, n1.Page_Rank); } }); } else if (search_option.equals("Rerank")) { Arrays.sort(ranking, new Comparator<NewRank>() { public int compare(NewRank n1, NewRank n2) { double score1 = 0, score2 = 0, omega = 0.5; try { score1 = omega * n1.score + (1 - omega) * n1.Page_Rank; score2 = omega * n2.score + (1 - omega) * n2.Page_Rank; } catch (Exception e) { System.out.println("Exception :" + e); } if (score1 < score2) return (1); else if (score1 == score2) return (0); else return (-1); } }); } } catch (Exception e) { } out.write("\r\n"); out.write("\r\n"); out.write("\r\n"); out.write("\r\n"); out.write("\r\n"); out.write(" "); if ((startindex + maxpage) > hits.totalHits) { thispage = hits.totalHits - startindex; // set the max index to maxpage or last } // actual search result whichever is less for (int i = startindex; i < (thispage + startindex); i++) { // for each element Document doc = ranking[i].Doc; String doctitle = doc.get("title"); //get its title String url = doc.get("path"); String html = doc.get("html"); //get its path field String content = doc.get("content"); String pagerank = doc.get("PageRank"); if (url != null && url.startsWith("../webapps/")) { // strip off ../webapps prefix if present url = url.substring(10); } if ((doctitle == null) || doctitle.equals("")) //use the path if it has no title doctitle = url; String body_content = doc.get("content"); String snippet; if (body_content != null) { snippet = highlighter(body_content, queryString.toLowerCase()); } out.write("\r\n"); out.write(" \r\n"); out.write(" <tr>\r\n"); out.write(" <td>"); out.print(i + 1); out.write(" </td><td><a href="); out.print("http://" + doc.get("html")); out.write(" style=\"color:blue;text-decoration: none;\">"); out.print(doctitle); out.write("</a></td>\r\n"); out.write(" <td style = \"width:180px\"> Page rank score : "); out.print(pagerank); out.write(" </td>\r\n"); out.write(" </tr>\r\n"); out.write(" <tr>\r\n"); out.write(" <td></td><td><a style=\"color:green;text-decoration: none;\">"); out.print(html); out.write("</a></td>\r\n"); out.write(" </tr>\r\n"); out.write(" <tr>\r\n"); out.write(" <td></td><td style=\" margin:10px;\r\n"); out.write(" overflow: hidden;\r\n"); out.write(" text-overflow: ellipsis;\r\n"); out.write(" display: -webkit-box;\r\n"); out.write(" -webkit-line-clamp: 3;\r\n"); out.write(" -webkit-box-orient: vertical;\">"); out.print(doc.get("contents")); out.write("</td>\r\n"); out.write(" </tr>\r\n"); out.write(" <tr><td> </td><td></td></tr>\r\n"); out.write(" "); } out.write('\r'); out.write('\n'); out.write(' '); if ((startindex + maxpage) < hits.totalHits) { //if there are more results...display //the more link String moreurl = "results.jsp?query=" + URLEncoder.encode(queryString) + //construct the "more" link "&maxresults=" + maxpage + "&startat=" + (startindex + maxpage); out.write("\r\n"); out.write(" <tr>\r\n"); out.write(" <td></td><td><a href=\""); out.print(moreurl); out.write("\">Next Results>></a></td>\r\n"); out.write(" </tr>\r\n"); out.write(" "); } out.write("\r\n"); out.write(" </table>\r\n"); out.write(" </div>\r\n"); out.write(" </div>\r\n"); out.write(" "); } //then include our footer. //if (searcher != null) // searcher.close(); out.write('\r'); out.write('\n'); out.write(' '); out.write("<!--\n"); out.write(" Licensed to the Apache Software Foundation (ASF) under one or more\n"); out.write(" contributor license agreements. See the NOTICE file distributed with\n"); out.write(" this work for additional information regarding copyright ownership.\n"); out.write(" The ASF licenses this file to You under the Apache License, Version 2.0\n"); out.write(" the \"License\"); you may not use this file except in compliance with\n"); out.write(" the License. You may obtain a copy of the License at\n"); out.write(" \n"); out.write(" http://www.apache.org/licenses/LICENSE-2.0\n"); out.write(" \n"); out.write(" Unless required by applicable law or agreed to in writing, software\n"); out.write(" distributed under the License is distributed on an \"AS IS\" BASIS,\n"); out.write(" WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n"); out.write(" See the License for the specific language governing permissions and\n"); out.write(" limitations under the License.\n"); out.write(" -->\n"); /* Author Andrew C. Oliver (acoliver2@users.sourceforge.net) */ out.write("\n"); out.write("<p align=\"center\">\n"); out.write("\t<!-- "); out.print(appfooter); out.write(" -->\n"); out.write("</p>\n"); out.write("</body>\n"); out.write("</html>\n"); out.write(" \r\n"); out.write(" "); } catch (java.lang.Throwable t) { if (!(t instanceof javax.servlet.jsp.SkipPageException)) { out = _jspx_out; if (out != null && out.getBufferSize() != 0) try { if (response.isCommitted()) { out.flush(); } else { out.clearBuffer(); } } catch (java.io.IOException e) { } if (_jspx_page_context != null) _jspx_page_context.handlePageException(t); else throw new ServletException(t); } } finally { _jspxFactory.releasePageContext(_jspx_page_context); } }
From source file:org.riotfamily.search.analysis.DefaultAnalyzerFactory.java
License:Apache License
public Analyzer getAnalyzer(String language) { if (language != null) { String snowballName = (String) snowballNames.get(language); if (snowballName != null) { String[] stopWords = getStopWords(language); if (stopWords != null) { return new SnowballAnalyzer(snowballName, stopWords); }/*from w ww . j av a 2s. c om*/ return new SnowballAnalyzer(snowballName); } if (language.equals("ja") || language.equals("ko") || language.endsWith("zh")) { return new CJKAnalyzer(); } if (language.equals("th")) { return new ThaiAnalyzer(); } if (language.equals("el")) { return new GreekAnalyzer(); } if (language.equals("cs")) { return new CzechAnalyzer(); } } return defaultAnalyzer; }