[英]hibernate search, existing data not searchable
i seem to be missing something during initialisation of hibernate search. 我似乎在休眠搜索初始化期间丢失了一些内容。
my mysql database table contains a few existing rows which dont seem to be returned as part of the results 我的mysql数据库表包含一些现有行,这些行似乎未作为结果的一部分返回
any new rows that i add through the application after starting it seem to be returned in the hibernate search 在启动之后,我通过应用程序添加的任何新行似乎都在休眠搜索中返回
i need to return all rows including the ones already existing in the table, what do i need to add to get it? 我需要返回所有行,包括表中已经存在的行,我需要添加什么才能获得它?
this is the code section i use to query 这是我用来查询的代码部分
// get the full text entity manager
FullTextEntityManager fullTextEntityManager=Search.getFullTextEntityManager(entityManager);
//create query using hibernate query DSL
QueryBuilder queryBuilder=fullTextEntityManager.getSearchFactory().buildQueryBuilder().forEntity(Entity.class).get();
// actual query
Query query=queryBuilder.keyword()
.onFields("col1","col2","col3")
.matching(searchKeyword)
.createQuery();
//wrap Lucene query in hibernate query object
FullTextQuery jpaQuery=fullTextEntityManager.createFullTextQuery(query, Entity.class);
return jpaQuery.getResultList();
You need to run the mass indexer to add all those entities to the index which have been added/updated while Hibernate Search was not (yet) enabled. 您需要运行质量索引器,以将尚未(尚未)启用Hibernate Search时已添加/更新的所有那些实体添加到索引中。
This will fetch all the entities from the database und update the corresponding index(es). 这将从数据库中获取所有实体,并更新相应的索引。 In its simplest form it's done like so: 最简单的形式是这样的:
fullTextEntityManager
.createIndexer( Entity.class )
.startAndWait();
The reference guide describes all the options for fine-tuning in detail. 参考指南详细介绍了所有用于微调的选项。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.