问题麻烦看下
jiqiumin
2008-04-17
我用JE的分词
分词还是可以分出来的,但是到了查询的时候老是报Exception in thread "main" java.lang.OutOfMemoryError: Java heap space错误,我的JVM已经设置的很大了啊 麻烦给点提示是哪里错了谢谢 以下查询代码 public void JE_Index(String Word, String Index, String Key) throws Exception { String temp = Word; int histtemp = 0; MMAnalyzer analyzer = new MMAnalyzer(); Searcher searcher = new IndexSearcher(Index); QueryParser parser = new QueryParser(Key, analyzer); Query query = null; try {//到这步就停了 query = parser.parse(All_Test.JE_Analyzer(Word)); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } Sort sort = new Sort(); long start = new Date().getTime(); Hits hits = searcher.search(query, sort); long end = new Date().getTime(); System.out.println("用时: " + (end - start) / 1000.0 + " seconds"); System.out.println(hits.length() + "条结果"); histtemp = hits.length(); if (histtemp > 100) { histtemp = 50; } for (int i = 0; i < histtemp; i++) { Document doc = new Document(); doc = hits.doc(i); System.out.println(doc.get("qiye") + "|" + hits.score(i));// } } |