Hibernate搜索框架 Hibernate Search 4.0.0.Beta1 发布
openkk 13年前
<p>Hibernate Search的作用是对数据库中的数据进行检索的。它是<span class="hilite1">hibernate</span>对著名的全文检索系统Lucene的一个集成方案,作用在于对数据表中某些内容庞大的字段(如声明为text的字段)建立全文索引,这样通过<span class="hilite1">hibernate</span> <span class="hilite2">search</span>就可以对这些字段进行全文检索后获得相应的POJO,从而加快了对内容庞大字段进行模糊搜索的速度(sql语句中like匹配)。</p> <p><strong>Hibernate Search主要有以下功能特点:</strong></p> <p>1,功能强大,配置简单 - 配置只需要修改persistence.xml(JPA),hibernate.cfg.xml(Hibernate)<br /> 2,支持Hibernate,以及EJB3 JPA标准应用<br /> 3,集成全文搜索引擎Lucene - Lucene是Apache项目组下的一个功能强大的全文搜索引擎项目<br /> 4,可以简单透明索引查询过的数据<br /> 5,支持复杂检索 - 支持Wild Card(诸如*, ?等通配符号),多关键字,模糊查询,排序等<br /> 6,支持Clustering<br /> 7,支持直接访问Lucene API<br /> 8,对Lucene索引,API的高效管理</p> <p><strong><span class="hilite1">Hibernate</span> <span class="hilite2">Search</span>运行的环境如下:</strong></p> <ul> <li>1、JDK或JRE 5.0以上</li> <li>2、<span class="hilite1">Hibernate</span>-<span class="hilite2">Search</span>以及相应的依赖包</li> <li>3、<span class="hilite1">Hibernate</span> Core 3.2.X</li> <li>4、<span class="hilite1">Hibernate</span> Annotations 3.3.X</li> </ul> <br /> <p>从 Alpha2 到 Beta1,今天 Hibernate Search 团队很高兴的发布了 4.0 的首个 Beta 版本,完整改进记录请看 <a href="https://hibernate.onjira.com/secure/ReleaseNote.jspa?projectId=10061&version=11360">Jira release notes</a>. 值得关注的改进有:</p> <ul> <li>The parameter list of the annotation <tt>org.hibernate.search.annotation.Field</tt> has changed (<a href="/misc/goto?guid=4958190584046512309">HSEARCH-710</a>, <a href="/misc/goto?guid=4958190584785648146">HSEARCH-711</a>). </li> <li>The annotation mixed the concepts of analyzing and storing of norms into a single index parameter (<tt>NO</tt>, <tt>TOKENIZED</tt>, <tt>UN_TOKENIZED</tt> and <tt>NO_NORMS</tt>). </li> <li>There was no option for analyzed indexing while storing no norms and the terminology was using the term <em class="wikiEmphasis">tokenizing</em> instead of <em class="wikiEmphasis">analyzing</em>. </li> <li>For this reason we changed the API and made the different choices more explicit:<pre class="wikiPreformatted"> @Field(index=Index.YES|NO, analyze=Analyze.YES|NO, norms=Norms.YES|NO, ...) </pre></li> <li>Another important API change is the ability to access an <tt>IndexReader</tt> by name (<a href="/misc/goto?guid=4958190585522471523">HSEARCH-903</a>). For this purpose an new interface <tt>IndexReaderAccessor</tt> got introduced. It can be accessed via <tt>SearchFactory#getIndexReaderAccessor</tt>. The interface offers the following methods:<pre class="wikiPreformatted">public interface IndexReaderAccessor { IndexReader open(Class... entities); IndexReader open(String... indexNames); void close(IndexReader indexReader); }</pre></li> <li>Last but not least, you can now project on fields added by custom bridges (<a href="/misc/goto?guid=4958190586259075191">HSEARCH-890</a>). </li> </ul> <p>开发文档:<a href="http://www.open-open.com/doc/search?q=Hibernate+&ft=all&od=0">http://www.open-open.com/doc/search?q=Hibernate+&ft=all&od=0</a><br /> 下载地址: <a href="/misc/goto?guid=4958190586997723403">SourceForge</a></p>