Questions tagged [hibernate-search]

Hibernate Search automatically extracts data from Hibernate ORM entities to push it to local Apache Lucene indexes or remote Elasticsearch indexes.

Hibernate Search provides synchronization between entities managed by Hibernate ORM and full-text indexing services like Apache Lucene and Elasticsearch.

It will automatically apply changes to indexes, which is tedious and error prone coding work, while leaving you full control on the query aspects. The development community constantly researches and refines the index writing techniques to improve performance.

Mapping your objects to the indexes is declarative, using a combination of Hibernate Search specific annotations and the knowledge it can gather from your existing Hibernate/JPA mapping.

Queries can be defined by any combination of:

  • "native" Apache Lucene queries
  • writing "native" Elasticsearch queries in JSON format (if using Elasticsearch, which is optional)
  • using a DSL which abstracts the previous two generating optimal backend specific queries

Query results can include projections to be loaded directly from the index, or can materialize fully managed Hibernate entities loaded from the database within the current transactional scope.

Hibernate Search is using Apache Lucene under the cover; this can be used directly (running embedded in the same JVM) or remotely provided by an Elasticsearch server over its REST API.

Hibernate Search is open source and contributions are welcome both as patches or comments and suggestions.

For latest news follow the Hibernate team blog.

1466 questions
5
votes
2 answers

Java generics - Class constructor argument issue

I've used Java for quite some time now, but some things are still not very clear to me, especially when it comes to generics... Here's the thing: I have this Search class that I'm using (see here for details), that is constructed like this: …
Less
  • 3,047
  • 3
  • 35
  • 46
5
votes
2 answers

@IndexedEmbedded on a list of lazily-loaded entities, does not get into the search index automatically

I have an issue, which I think should be easily solved. I use Hibernate Search to index @Entitiy classes which have relations to other entities. Whenever an entity points to another entity that should be indexed as well, say the User who uploaded a…
Preslav Rachev
  • 3,983
  • 6
  • 39
  • 63
5
votes
3 answers

How to integrate full text search in Spring-data-jpa?

Is there a way to integrate full text search with spring data jpa? I am used to use hibernate search in my project. Hibernate search(Hibernate Search brings the power of full text search engines to the persistence domain model by combining…
Tom
  • 2,857
  • 9
  • 46
  • 59
5
votes
1 answer

Transaction ACID properties with Hibernate Search + Infinispan Directory

I have the following setup: JPA (2.0) through Hibernate (4.1) Infinispan as 2nd level cache (5.1) Hibernate Search connected to Hibernate (4.1) Infinispan as Directory for Hibernate Search (Lucene) Connected a JDBC CacheStore for the Infinispan…
Luciano
  • 8,552
  • 5
  • 32
  • 56
4
votes
1 answer

Spring transaction that uses JPA throws Exception during AfterCompletion phase

I have a web application that uses the Spring Framework (3.1) and persistence through JPA (2.0) backened by Hibernate (4.1.1) Hibernate Search is also enabled (4.1 RC). Hibernate's Second Level cache is Infinispan (5.1.3). I also use Infinispan as…
Luciano
  • 8,552
  • 5
  • 32
  • 56
4
votes
3 answers

Indexing data in Hibernate Search

I just started integrating Hibernate Search with my Hibernate application. The data is indexed by using Hibernate Session every time I start the server. FullTextSession fullTextSession = Search.getFullTextSession(session); Transaction tx =…
Shashi
  • 12,487
  • 17
  • 65
  • 111
4
votes
3 answers

How to combine Hibernate Search (Lucene) with paging and ACLs

I am using Spring Security with ACLs to secure the documents in my application. On the other hand I use Hibernate Search (on top of lucene) to search for the documents. This search also support paging. (Documents are only meta data of documents…
Ralph
  • 118,862
  • 56
  • 287
  • 383
4
votes
1 answer

Hibernate search with Criteria restriction returning incorrect count

The result list is perfect but the getResultSize() is incorrect. I've knocked up some code to illustrate. Criteria criteria2 = this.getSession().createCriteria(Film.class); Criterion genre =…
jaseFace
  • 1,415
  • 5
  • 22
  • 34
4
votes
1 answer

java.lang.ClassCastException: com.sun.proxy.$Proxy62 cannot be cast to org.hibernate.engine.spi.SessionImplementor

I'm having an issue with Spring and Hibernate Search. Here is my code: @Slf4j @Repository public class DefaultIndexBuilderDao implements IndexBuilderDao { @PersistenceContext @Getter @Setter private EntityManager entityManager; …
csyperski
  • 992
  • 3
  • 15
  • 33
4
votes
1 answer

Spring Boot app won't start after upgrade from SB 2.2.7 to SB 2.3.0

I use Java 8, Spring Boot and Hibernate Search and it looks like the app startup stops at Lucene index initialization. Tried to use index files previously built with SB 2.2.7 and no success. Also tried to remove all files made by Lucene and give it…
horvoje
  • 643
  • 6
  • 21
4
votes
1 answer

Hibernate Search failing while creating initial indexes

I'm trying to integrate Hibernate Search in a Spring Boot 2 app. I have tried different versions following the compatibility list on their site but I always get this error when the app is started and…
4
votes
1 answer

How to remove old Hibernate Search index

I use Hibernate search for full text search in my web application. I have button for index creation in admin panel. I do it by this code: fullTextSession.createIndexer() .purgeAllOnStart(true) …
AmarthG
  • 41
  • 1
  • 3
4
votes
1 answer

Faceting hibernate search results by Instant range fails

I have an entity with indexed creation timestamp of java.time.Instant type and I'd like to facet search results by creation timestamp range. The entity looks the following way: @Entity @Indexed public class Document { @Id @DocumentId …
Ilya Zinkovich
  • 4,082
  • 4
  • 25
  • 43
4
votes
1 answer

How to implement a @FieldBridge to an @EmbeddedId field

When there is an @EmbeddedId field, a custom Field Bridge should be implemented. There is a Feature opened about it https://hibernate.atlassian.net/browse/HSEARCH-1879. But it isn't ready yet. In this case, the interface correct to implement is…
Ady Junior
  • 1,040
  • 2
  • 10
  • 18
4
votes
1 answer

Version 5.7.1.Final of HibernateSearch complains about ElasticSearch yellow index status

I tried upgrading HibernateSearch from version 5.7.0.Alpha1 to version 5.7.1.Final, but it's not possible. I get the following error when running my application compiled with the Final version: Exception in thread "main"…
nuoritoveri
  • 2,494
  • 1
  • 24
  • 28