hibernate search 手动创建索引
hibernate search默认采用自动创建索引
只要在entity上配置上@Indexed注解,在插入数据时hibernate就自动的索引数据
实际上是可以配置成手动索引的
配置如下
<prop key="hibernate.search.indexing_strategy">manual</prop>
private static String defineIndexingStrategy(SearchConfiguration cfg) {String indexingStrategy = cfg.getProperties().getProperty( Environment.INDEXING_STRATEGY, "event" );if ( !( "event".equals( indexingStrategy ) || "manual".equals( indexingStrategy ) ) ) {throw new SearchException( Environment.INDEXING_STRATEGY + " unknown: " + indexingStrategy );}return indexingStrategy;}