doc.add(new Field("title", title, Field.Store.YES, Field.Index.ANALYZED));Field.Store :YES 可以搜索,保存原值 :NO 可以搜索,不保存原值 :COMPRESS 可以搜索,压缩保存原值 这里需要注意的是在实际使用中,并不建议使用COMPRESS,存在压缩和解压过程,效率低下,对于大文本尽量使用NO 还有一点就是是否可被搜索与Store无关,只与Index有关。Field.Index :ANALYZED: 分词建索引 :ANALYZED_NO_NORMS: 分词建索引,但是Field的值 Read More
posted @ 2011-08-11 16:58 linyu2006 Views(631) Comments(0) Diggs(1) Edit
优化索引,使多个Segments变成一个Segments optimize() 指定最大Segments的数量 optimize(int maxNumSegments) 前面的方面都是优化完成之后再返回,这个方法的参数如果是FALSE的话,就直接返回,再开一个线程来优化 optimize(boolean doWait) 前面两个参数的组合哈 optimize(int maxNumSegments, boolean doWait) 优化索引,使多个Segments变成一个Segments optimize() //指定最大Segments的数量 optimize(int maxNumSegmen Read More
posted @ 2011-08-11 16:35 linyu2006 Views(401) Comments(0) Diggs(0) Edit