Configuration infinispanConfiguration = new ConfigurationBuilder() .indexing() .enable() .indexLocalOnly(true) .build(); DefaultCacheManager cacheManager = new DefaultCacheManager(infinispanConfiguration)
@Indexed @ProvidedId
public class Book {
@Field String title;
@Field String description;
@Field String author;
@Field int yearOfPublication ;
String briefDescription;
int edition;
boolean isBestSeller;
}
答案 0 :(得分:2)
如您所知Infinispan使用Hibernate Search&使用索引模块时的Apache Lucene。
根据您的配置,您使用Lucene索引的默认值。您可以指定许多选项来提高索引性能。
您可以参考以下内容获取更多信息
[1] https://docs.jboss.org/author/display/ISPN/Querying+Infinispan [2] http://docs.jboss.org/hibernate/stable/search/reference/en-US/html_single/#lucene-indexing-performance
答案 1 :(得分:0)
我遇到了同样的问题。
25000本书的插入(来自Infinispan用户指南)耗时361秒
ConfigurationBuilder config = new ConfigurationBuilder();
config.indexing().index(Index.LOCAL);
25000本书的插入需要1.6秒
ConfigurationBuilder config = new ConfigurationBuilder().indexing().setProperty("default.directory_provider", "ram").setProperty("default.indexmanager", "near-real-time");
config.indexing().index(Index.LOCAL);