我使用以下命令在gfsh中创建了 lucene 索引create lucene index --name=myLucIndex --region=myRegion --field=title
--analyzer=org.apache.lucene.analysis.en.EnglishAnalyzer --serializer=a.b.c.MyLatLongSerializer
我的序列化程序如下:
class MyLatLongSerializer implements LuceneSerializer<Book> {
@Override
public Collection<Document> toDocuments(LuceneIndex luceneIndex, Book book) {
logger.debug("inside custom lucene serializer ...");
// Writes fields of Book into a document
Document newDocument = new Document();
newDocument.add(new StoredField("title", book.getTitle()));
newDocument.add(new LatLonPoint("location", book.getLatitude(), book.getLongitude()));
return Collections.singleton(newDocument);
}
}
我的spring boot配置文件如下:
@Configuration
@ClientCacheApplication
@EnableClusterDefinedRegions(clientRegionShortcut = ClientRegionShortcut.CACHING_PROXY)
@EnableIndexing
public class BookConfiguration {
@Bean(name = "bookGemfireCache")
ClientCacheConfigurer bookGemfireCache(
@Value("${spring.data.geode.locator.host:localhost}") String hostname,
@Value("${spring.data.geode.locator.port:10334}") int port) {
// Get clientCache
}
@Bean
Region<Long, Book> bookRegion(ClientCache clientCache) {
logger.debug("inside regions ...");
return clientCache.getRegion("myRegion");
}
@Bean
LuceneService ukBikesLuceneService(ClientCache clientCache) {
return LuceneServiceProvider.get(clientCache);
}
}
我使用以下代码将数据加载到 geode:
bookRegion.putAll(Map<bookId, Book>);
describe lucene index --name=myLucIndex --region=myRegion
然后记录 # 0但是当我使用以下命令创建 lucene 索引时
create lucene index --name=myLucIndex --region=myRegion --field=title
--analyzer=org.apache.lucene.analysis.en.EnglishAnalyzer
然后再次加载数据,运行
describe lucene index --name=myLucIndex --region=myRegion
然后是文件#96。
我使用弹簧数据 geode 2.1.8.RELEASE、geode-core 1.9.0、lucene-core 8.2.0
我在这里想念什么?