Lucene
文章平均质量分 57
hi_beijing
这个作者很懒,什么都没留下…
展开
-
lucene文本高亮
public static String getHighLight(Document doc, Analyzer analyzer, Query query, String field) throws Exception { SimpleHTMLFormatter simpleHTMLFormatter = new SimpleHTMLFormatter("<b>", "&...原创 2012-01-16 15:01:54 · 143 阅读 · 0 评论 -
java的搜索引擎之Lucene的创建和搜索高亮
TermQuery 关键字查询;RangeQuery 范围查询;WildcardQuery 通配符查询;PhraseQuery 短语查询;booleanQuery boolean查询; package cn.mmclbs.com;import java.io.File;import jeasy.analysis.MMAnalyzer;import org.a...原创 2012-01-16 15:20:18 · 146 阅读 · 0 评论 -
lucene的jar包
lucene的jar包:原创 2012-02-05 14:47:49 · 131 阅读 · 0 评论 -
Lucene创建索引的优化
/** * 操作索引库是用来(增删改)索引 * * @throws Exception */ @Test public void createIndex() throws Exception { long star = System.currentTimeMillis(); IndexWriter indexWriter = null; RA...原创 2012-02-05 14:56:15 · 120 阅读 · 0 评论 -
Lucene的增删改查的操作
@Test public void saveIndex() throws Exception { File file = new File(indexPath); FSDirectory dir = FSDirectory.getDirectory(file); Document doc = File2DocumentUtils.file2Document(filePat...原创 2012-02-05 15:58:13 · 112 阅读 · 0 评论 -
Lucene相关度排序
/** * 搜索 */ @Test public void search() throws Exception { String queryString = "笑话"; Map<String, Float> boostMap = new HashMap<String, Float>(); //默认是1.0f //boo...原创 2012-02-05 16:59:37 · 132 阅读 · 0 评论 -
Lucene升序降序排序
/** * 搜索 */ @Test public void search() throws Exception { String queryString = "笑话"; // 把要搜索的文本解析成Query String[] fields = {"name", "content"}; QueryParser queryParser = new M...原创 2012-02-05 17:06:36 · 211 阅读 · 0 评论