lucene:IndexSearch

		IndexSearcher is = new IndexSearcher("C:\\luceneIndex");	
		//对path 进行分词,否则只有输入文章全名才能搜索到
		QueryParser qp = new QueryParser("path", new StandardAnalyzer());
		Query q = qp.parse("安徽");	
		Hits hits = is.search(q);
		System.out.println(hits.length());
		for(int i=0;i<hits.length();i++){
			System.out.print(hits.doc(i)+"\t"+hits.score(i));
			System.out.println();
		}
 

你可能感兴趣的:(Lucene)