lucene笔记

1,Field.Store与Field.Index
  Field.Store.COMPRESS:用压缩的格式存储最初的Field值
  Field.Store.NO:不存储该Field的原始值
  Field.Store.YES:存储该Field的原始值

  Field.Index.NO:不索引Field的值
  Field.Index.NO_NORMS:
  Field.Index.TOKENIZED:作分词处理
  Field.Index.UN_TOKENIZED:不分词,直接作为完整的信息段检索,可以支持全匹配和相似匹配,跟数据库中的like很类似。

2,实现Filter接口
     public  BitSet bits(IndexReader reader)  throws  IOException {
        
final  BitSet bits  =   new  BitSet(reader.maxDoc()); //  默认所有都为false
        
//  设置所有的都不能检索到
        
//  bits.set(0, bits.size() - 1, false);
        bits.set( 3 true );
        bits.set(
4 ); // 设置为true
         int [] docs  =   new   int [ 1000 ];
        
int [] freqs  =   new   int [ 1000 ];
        TermDocs termDocs 
=  reader.termDocs( new  Term( " title " " 测试 " ));
        
int  count  =  termDocs.read(docs, freqs); //
         for  ( int  i  =   0 ; i  <  docs.length; i ++ ) {
            System.out.println(docs[i]
+ " -- " + freqs[i]);
            bits.set(docs[i]);
        }
        
return  bits;
    }

3,Term t = new Term("content", "电力");
  Query query = new TermQuery(t);
  以上搜不到结果.原因是"电力"不是一个Term,用"电"或"力"则可以。

4, reader.terms()返回索引中的所有term,没有重复。而TermDocs存放term关联的Doc
TermEnum enumerator  =  reader.terms();
while  (enumerator.next()) {
Term term 
=  enumerator.term();
System.out.println(term.field() 
+   "   "   +  term.text());
}

5,lucene不支持中文的*  ?匹配  
  因为英文是基于词的, 中文是基于字的  
  英文mo?ey可以匹配到money ,因为money是一个term,  中文怎么办?除非中文有个好的分词方案
6,两次过滤后,query对象的tostring:
filtered(filtered(title:oracle content:oracle)->com.lucene.search.PrivilegeFilter@133d0fc)->com.lucene.search.CategoryFilter@dd5415
7,Hyper Estraier是一个用C语言开发的全文检索引擎,
具有高速度,高稳定性,高可扩展性?提供java,ruby的调用方法
<迅速搭建全文搜索平台——开源搜索引擎实战教程>
http://www.162cm.com/archives/date/2007/07/18
 
 1.Hyper Estraier是一个用C语言开发的全文检索引擎,他是由一位日本人开发的.工程注册在sourceforge.net(http://hyperestraier.sourceforge.net). 2.Hyper的特性: 高速度,高稳定性,高可扩展性…(这可都是有原因的,不是瞎吹) P2P架构(可译为端到端的,不是咱们下大片用的p2p) 自带Web Crawler 文档权重排序 良好的多字节支持(想一想,它是由日本人开发的….) 简单实用的API(我看了一遍,真是个个都实用,我能看懂的,也就算简单了) 短语,正则表达式搜索(这个有点过了,不带这个,不是好的Full text Search Engine?) 结构化文档搜索能力(大概就是指可以自行给文档加上一堆属性并搜索这些属性吧?这个我没有实验) Hyper Estraier is a full-text search system. You can search lots of documents for some documents including specified words. If you run a web site, it is useful as your own search engine for pages in your site. Also, it is useful as search utilities of mail boxes and file servers. The characteristic of Hyper Estraier is the following. High performance of search High scalability of target documents Perfect recall ratio by N-gram method High precision by hybrid mechanism of N-gram and morphological analyzer Phrase search, regular expressions, attribute search, and similarity search Multilingualism with Unicode Independent of file format and repository Intelligent web crawler Simple and powerful API Supporting P2P architecture Hyper Estraier is an open-source software released under the terms of the GNU Lesser General Public License. It works on Linux, Windows, Mac OS X, and other UNIX-like systems.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值