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
2
votes
1 answer

Hibernate Search @IndexedEmbedded on a polymorphic relationship (@Any, @ManyToAny)

I'm using Hibernate Search and looking to index an object that has polymorphic relationships that use @Any and/or @ManyToAny. @Indexed public class Foo { @Any(metaDef="fooOwnerType", metaColumn=@Column(name="ownerType")) …
2
votes
1 answer

Hibernate Search count directly instead of normal query with Lucene and Elasticsearch

Situation: I use Apache-Lucene Indices with Hibernate Search in my Java Application. For Pagination I want to count all hits of a query on a single index. Right now I'm evaluating a migration away from Apache-Lucene, to Elasticsearch (ES) as the…
paul
  • 23
  • 2
2
votes
1 answer

How to annotate to allow for searching a List field using Hibernate Search

Let's say I have a domain object that looks like this: @Entity @Indexed public class Thingie implements DomainObject { private Long id; private Integer version; private String title; private List keywords = new…
Bert Lamb
  • 2,317
  • 2
  • 20
  • 26
2
votes
2 answers

Proper way to full text search an sql database using Elasticsearch in a Spring boot application

I want to add a full text search functionality to my Spring Boot application, data should be stored in an SQL database, I also read that using ES as a primary database is not recommended. One way I thought of is: create, update and delete operations…
Ala Abid
  • 2,256
  • 23
  • 35
2
votes
1 answer

Why is Lucene sometimes not matching InChIKeys?

I have indexed my database using Hibernate Search. I use a custom analyzer, both for indexing and for querying. I have a field called inchikey that should not get tokenized. Example values…
Simmer
  • 163
  • 1
  • 9
2
votes
1 answer

FullTextHibernateSessionProxy is not visible from class loader

I have run into a very strange error that I can´t wrap my head around. I´m running Seam 2.2.1.CR2 and JBoss 4.3.0.GA. My application consist of 3 modules: application.xml CoolWebApp
jakob
  • 5,979
  • 7
  • 64
  • 103
2
votes
0 answers

ComplexPhraseQueryParser

I would like to implement for my website a fuzzy phrase search using Hibernate Search. I've read from some people that ComplexPhraseQueryParser is ok for this. But the thing is that I have some missunderstandings or issues related to it. So for…
Qfeast Quizzes
  • 145
  • 2
  • 12
2
votes
1 answer

Hibernate-Search flushToIndexes causing java.lang.OutOfMemoryError (heap space)

I've a Spring application, using Hibernate, and connected to Elasticsearch through Hibernate-Search. To simplify the example, I'll put only required annotations and code. I've an entity A, contained in multiple B entities (a lot, actually…
Relacks
  • 21
  • 2
2
votes
1 answer

Hibernate Search query for multiple entities

I would like to build a hibernate query over multiple entities with entity-specific restrictions. Ideally, all results would be returned from the same query so that they could be sorted against each other by relevance. The entities are Event,…
tmcdevitt
  • 1,200
  • 1
  • 7
  • 9
2
votes
2 answers

Hibernate Search Mass Indexer Doesn't Drop Mappings

I am currently using the MassIndexer like so to reindex my entities: fullTextSession.createIndexer().startAndWait(); However, I have learned that the MassIndexer does not drop the existing mappings. It seems like the only way to drop mappings is to…
logeyg
  • 549
  • 2
  • 8
  • 31
2
votes
1 answer

Specifying keyword type on String field

I started using hibernate-search-elasticsearch(5.8.2) because it seemed easy to integrate it maintains elasticsearch indices up to date without writing any code. It's a cool lib, but I'm starting to think that it has a very small set of the…
Hristo Angelov
  • 1,019
  • 1
  • 15
  • 34
2
votes
2 answers

Hibernate Search Dynamic Mapping

I am attempting to utilize elastic search with hibernate by using the hibernate-search elastic search integration. I have multi-tenant data that uses a discriminator strategy, so it would be great to index entities with that tenant identifier…
logeyg
  • 549
  • 2
  • 8
  • 31
2
votes
1 answer

How to handle synonyms and stop words when building a fuzzy query with Hibernate Search Query DSL

Using Hibernate Search (5.8.2.Final) Query DSL to Elasticsearch server. Given a field analyzer that does lowercase, standard stop-words, then a custom synonym with: company => co and finally, a custom stop-word: co And we've indexed a vendor name:…
Rick Gagne
  • 152
  • 1
  • 1
  • 10
2
votes
1 answer

EntityManagerHolder cannot be cast to org.springframework.orm.hibernate5.SessionHolder

I'm using this code to configure Spring with Hibernate: @SpringBootApplication @Configuration @EnableTransactionManagement public class ContextServer { @Bean public LocalSessionFactoryBean getSessionFactory() { …
Peter Penzov
  • 1,126
  • 134
  • 430
  • 808
2
votes
1 answer

Match null of non-string field in Hibernate Search query

I am trying to implement a query for the following logic: Match results where endDate is above now OR endDate is not present (i.e. null) So far, I am able to do the first part as following: dateQuery = queryBuilder.range() …
Turzo
  • 490
  • 1
  • 5
  • 14