04 2011 档案
摘要:在linux操作系统(redhat 5.0)中文乱码 我整了很久 结果没有搞定 参照网上很多资料 终于搞定!1,cd /usr/share/fonts2,mkdir truetype3,cd truetype4,mkdir simsun5,使用FTP或SFTP将Windows下的simsun.tcc文件传到/usr/share/fonts/truetype/simsun/目录中 并且cd到当前目录下6,执行 mkfontscale 生成了fonts.scale文件7,执行 mkfontdir 生成了fonts.dir文件8,chkfontpath --add /usr/share/fonts/
阅读全文
摘要:1 使用FileWriter写中文xml出现乱码 很怪异。XMLWriter writer=null;try{Document doc=DocumentHelper.parseText(result);OutputFormat format=OutputFormat.createPrettyPrint();format.setEncoding("UTF-8"); //FileOutputStream fos=new FileOutputStream(new File("C:\\GeoSearchResponse.xml"));writer=new XML
阅读全文
摘要:WEB-INF/spring/appServlet/servlet-context.xmlview sourceprint?01<?xml version="1.0" encoding="UTF-8"?> 02<beans xmlns="http://www.springframework.org/schema/beans"03xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"04xmlns:mvc="http://www.spri
阅读全文
摘要:在lucene3.0中,范围查询也有很大的变化,RangeQuery已经不推荐使用,使用TermRangeQuery和NumericRangeQuery两个替代。TermRangeQuery:主要用于文本范围查找;IndexReader reader = IndexReader .open(FSDirectory.open(INDEX_DIR), true); // only searching,Searcher searcher = new IndexSearcher(reader);String field = "starttime";TermRangeQuery qu
阅读全文
摘要:使用Lucene做全文检索,一般我们经常会在多个字段(域)中查找,而不一定关心在那个字段中包含需要查找的值.比如在搜索框中输入:亲亲宝宝 软件开发,只要标题、内容、作者等包含“亲亲宝宝 软件开发”都是我们要查找的结果。Lucene中MultiFieldQueryParser正好给我们提供多字段查找带来方便.MultiFieldQueryParser multiParser= new MultiFieldQueryParser(Version.LUCENE_CURRENT,new String[]{"title","content","autho
阅读全文
摘要:由于lucene生成索引文件比较耗时,索引我们可以把经常变动的和不变化的防到两个索引文件中,查询时使用联合查询,可以在两个索引中同时查找.IndexSearcher[] searchers = new IndexSearcher[2];searchers[0] = new IndexSearcher(m_indexpath); searchers[1] = new IndexSearcher(m_outindexpath); MultiSearcher multiSearcher = new MultiSearcher(searchers);TopScoreDocCollector colle
阅读全文
摘要:Lucene 查询的保留字有:+ – &| ! ( ) { } [ ] ^ ~ * ? : \ 还有 AND OR NOT这些关键字,在查询之前要进行替换或过滤可以这样去掉:String str=www.wenhq.com \[luncene关键字]+ – &| ! ( ) { } [ ] ^ ~ * ? :\\";str =str.replaceAll("\"|\\+|\\-|\\&|\\||\\!|\\(|\\)|\\{|\\}|\\[|\\]|\\^|\\~|\\*|\\?|\\:|\\\\", " ")
阅读全文