休眠搜索索引无法正常工作

阿卜杜萨玛德·提姆

我正在尝试将休眠搜索集成到我现有的应用程序中。根据休眠搜索的教程,我在applicationContext.xml的休眠属性中添加了以下属性

<prop key="hibernate.search.default.directory_provider">org.hibernate.search.store.FSDirectoryProvider</prop>  
<prop key="hibernate.search.default.indexBase">./lucene/indexes</prop> 

另外,我在要启用搜索的实体类上添加了注释。在类上使用@Indexed,在字段上使用@Field。

以下是我使用的版本(我不使用Maven):

  • 休眠搜索-3.2.0.Final
  • 休眠公共注释4.0.1最终版
  • 休眠核心-4.1.11最终版
  • 休眠实体管理员-3.4.0.GA
  • 春天-3.2.2 REALEASE
  • lucene-core-3.2.0

我正在使用此示例代码在MySQL数据库中执行搜索:

public void search() {

FullTextSession searchSession = Search.getFullTextSession(sessionFactory.getCurrentSession());

QueryParser parser = new QueryParser(Version.LUCENE_32, "contenu", new StandardAnalyzer(Version.LUCENE_32));

org.apache.lucene.search.Query query = parser.parse("décarbonateront");

org.hibernate.Query hibQuery = searchSession.createFullTextQuery(query, Book.class);

List result = hibQuery.list();

System.out.println("lucene results: " + result.size());

}

但是我得到这个错误: The type org.hibernate.classic.Session cannot be resolved. It is indirectly referenced from required .class files

在 : searchSession.createFullTextQuery(query, Book.class);

可能是什么问题?

哈代

您需要对齐Hibernate和Hibernate Search版本。您需要Hibernate 3.5.x才能进行Hibernate Search 3.2。检查Maven pom中的版本-https: //repository.jboss.org/nexus/content/repositories/public/org/hibernate/hibernate-search-parent/3.2.0.Final/hibernate-search-parent- 3.2.0.Final.pom

您也可以从Sourceforge下载Hibernate Search发行版。该发行版还包含所有正确的依赖项。

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

休眠搜索索引-Infinispan目录和数据库?

来自分类Dev

为每个子类创建单独的休眠搜索索引

来自分类Dev

为每个子类创建单独的休眠搜索索引

来自分类Dev

Windows搜索服务无法创建新的搜索索引

来自分类Dev

无法重新索引所有搜索索引

来自分类Dev

休眠:HQL无法正常工作

来自分类Dev

查询Sphinx搜索索引

来自分类Dev

多值云量搜索索引

来自分类Dev

jsonb文本搜索索引

来自分类Dev

Ngram的弹性搜索索引?

来自分类Dev

休眠使复合密钥无法正常工作

来自分类Dev

休眠的懒惰获取无法正常工作

来自分类Dev

休眠问题,使复合密钥无法正常工作

来自分类Dev

休眠-@Transactional无法正常工作吗?

来自分类Dev

搜索功能无法正常工作

来自分类Dev

阵列搜索无法正常工作

来自分类Dev

目录搜索无法正常工作

来自分类Dev

Ajax搜索无法正常工作

来自分类Dev

Z索引无法正常工作

来自分类Dev

for循环的索引无法正常工作

来自分类Dev

MySQL索引无法正常工作

来自分类Dev

Azure 搜索索引索引器问题

来自分类Dev

CodeIgniter搜索引擎无法正常工作-仅获取已发布的帖子

来自分类Dev

CodeIgniter搜索引擎无法正常工作-仅获取已发布的帖子

来自分类Dev

为什么我的JavaScript搜索引擎无法正常工作?

来自分类Dev

Haystack与Elasticsearch拒绝创建搜索索引

来自分类Dev

狮身人面像搜索索引

来自分类Dev

Elasticsearch搜索索引类型限制

来自分类Dev

如何删除搜索索引本身