2008-03-31
Chapter 3. hibernate search configuration
关键字: hibernate search
Apache Lucene has a 概念 of Directory to store the index files
这个目录实现可以自定义。但是Lucene绑定文件系统FSDirectoryProvider 内存模式memory(RAMDirectoryProvider)2种实现。Hibernate Search 提供DirectoryProvider 概念处理Lucene目录问题。内建Directory Providers
1 org.hibernate.search.store.FSDirectoryProvider
2 org.hibernate.search.store.FSMasterDirectoryProvider
3 org.hibernate.search.store.FSSlaveDirectoryProvider
4 org.hibernate.search.store.RAMDirectoryProvider
2,3实现应该是为JMS模式的集群部署设置的。单机部署不需要。如果这些都不合适你。可以实现org.hibernate.store.DirectoryProvider interface
每个被索引的实体被分配一个lucene索引(一个索引能被多个实体共享。虽然大部分时候不这么用。)你能配置索引通过属性prefixed by hibernate.search.indexname。
默认属性继承给所有的索引可以被定义使用 the prefix hibernate.search.default.
定义索引目录provider。可以使用hibernate.search.indexname.directory_provider
-------------------------------------------------
hibernate.search.Rules.directory_provider org.hibernate.search.store.RAMDirectoryProvider
将Rules索引设置为内存模式。
hibernate.search.default.directory_provider org.hibernate.search.store.FSDirectoryProvider
hibernate.search.default.indexBase=/usr/lucene/indexes
上面2行配置将在/usr/lucene/indexes/Status保存Stauts对象的索引信息
-------------------------------------------------
3.4索引切割
在一些极端情况,涉及到大尺寸的是索引文件。必须切割成多个索引文件。但不建议这样除非达到巨大的数量并且更新索引的速度很慢。主要的缺点是查询将变慢。因为不得不为单个搜索打开更多的文件。换句话说,除非迫不得已不要这样做!
尽管如此,hibernate search依然允许你索引到多个子索引中,通过使用IndexShardingStrategy.默认情况是不打开的。除非分割的数量被配置了。
这部分内容还有很多,参考英文文档。因为我暂时不需要这个!
3.6打开hibernate search和自动索引功能
Hibernate Search is enabled out of the box when using Hibernate Annotations or Hibernate EntityManager.
如果需要关闭,设置hibernate.search.autoregister_listeners为false
Note that
要使用hibernate search功能。添加FullTextIndexEventListener。
再说一次。这个配置对Annotations EntityManager无效??什么意思?没明白。
Be sure to add the appropriate jar files in your classpath
添加合适的包。。
hibernate-search.jar lucene-core.*.jar
如果使用Hibernate Core 3.2.6及以上版本,确保添加了额外的事件监听以应付集合事件。(collection events)
这些额外的事件监听器是在3.2.6被引入的。注意FullTextIndexCollectionEventListener的用法。你必须明确的引用这些事件监听除非你使用Hibernate Annotations3.3.1及以上。
3.6.2自动索引。
默认自动在通过hibernate添加删除更新时索引。一些时间期望关闭这些功能。如索引为只读或者索引更新批量see Chapter 6, Manual indexing
这个目录实现可以自定义。但是Lucene绑定文件系统FSDirectoryProvider 内存模式memory(RAMDirectoryProvider)2种实现。Hibernate Search 提供DirectoryProvider 概念处理Lucene目录问题。内建Directory Providers
1 org.hibernate.search.store.FSDirectoryProvider
2 org.hibernate.search.store.FSMasterDirectoryProvider
3 org.hibernate.search.store.FSSlaveDirectoryProvider
4 org.hibernate.search.store.RAMDirectoryProvider
2,3实现应该是为JMS模式的集群部署设置的。单机部署不需要。如果这些都不合适你。可以实现org.hibernate.store.DirectoryProvider interface
每个被索引的实体被分配一个lucene索引(一个索引能被多个实体共享。虽然大部分时候不这么用。)你能配置索引通过属性prefixed by hibernate.search.indexname。
默认属性继承给所有的索引可以被定义使用 the prefix hibernate.search.default.
定义索引目录provider。可以使用hibernate.search.indexname.directory_provider
-------------------------------------------------
hibernate.search.Rules.directory_provider org.hibernate.search.store.RAMDirectoryProvider
将Rules索引设置为内存模式。
hibernate.search.default.directory_provider org.hibernate.search.store.FSDirectoryProvider
hibernate.search.default.indexBase=/usr/lucene/indexes
上面2行配置将在/usr/lucene/indexes/Status保存Stauts对象的索引信息
-------------------------------------------------
3.4索引切割
在一些极端情况,涉及到大尺寸的是索引文件。必须切割成多个索引文件。但不建议这样除非达到巨大的数量并且更新索引的速度很慢。主要的缺点是查询将变慢。因为不得不为单个搜索打开更多的文件。换句话说,除非迫不得已不要这样做!
尽管如此,hibernate search依然允许你索引到多个子索引中,通过使用IndexShardingStrategy.默认情况是不打开的。除非分割的数量被配置了。
引用
hibernate.search.<indexName>.sharding_strategy.nbr_of_shards 5
这部分内容还有很多,参考英文文档。因为我暂时不需要这个!
3.6打开hibernate search和自动索引功能
Hibernate Search is enabled out of the box when using Hibernate Annotations or Hibernate EntityManager.
如果需要关闭,设置hibernate.search.autoregister_listeners为false
Note that
引用
there is no performance runtime when the listeners are enabled while no entity is indexable.
要使用hibernate search功能。添加FullTextIndexEventListener。
引用
Once again, such a configuration is not useful with
Hibernate Annotations or Hibernate EntityManager.
Hibernate Annotations or Hibernate EntityManager.
再说一次。这个配置对Annotations EntityManager无效??什么意思?没明白。
Be sure to add the appropriate jar files in your classpath
添加合适的包。。
hibernate-search.jar lucene-core.*.jar
如果使用Hibernate Core 3.2.6及以上版本,确保添加了额外的事件监听以应付集合事件。(collection events)
引用
<event type="post-collection-recreate"/>
<listener class="org.hibernate.search.event.FullTextIndexCollectionEventListener"/>
</event>
<listener class="org.hibernate.search.event.FullTextIndexCollectionEventListener"/>
</event>
这些额外的事件监听器是在3.2.6被引入的。注意FullTextIndexCollectionEventListener的用法。你必须明确的引用这些事件监听除非你使用Hibernate Annotations3.3.1及以上。
3.6.2自动索引。
默认自动在通过hibernate添加删除更新时索引。一些时间期望关闭这些功能。如索引为只读或者索引更新批量see Chapter 6, Manual indexing
引用
hibernate.search.indexing_strategy manual
发表评论
- 浏览: 21870 次
- 性别:

- 来自: 杭州

- 详细资料
搜索本博客
我的相册
safari
共 8 张
共 8 张
最近加入圈子
最新评论
-
看Rails2怎么贯彻REST思想 ...
ActiveResource对REST 支持的确是很好。
-- by hqman -
多次遇到JSTL标签无效的原 ...
我有这个加了这个引入文件,但是还是没有出来,jstl还是不起作用 。
-- by zouming_3 -
汶川县7.8级地震阿坝州情 ...
哎,中国万岁。中国今年真倒霉。
-- by 狂放不羁 -
ESB Mule
可否介绍一下,那个ESB工具较好,并且是开源的。
-- by zhongzhao_2008 -
Rails 2.0: Scaffold
看着老版书,却用着2.0。真的很痛苦。不知道哪里有全系列的2.0教程
-- by wutao8818






评论排行榜