Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork246
Hibernate Search: full-text search for domain model
License
hibernate/hibernate-search
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Hibernate Search automatically extracts data from Hibernate ORM entities to push it tolocalApache Lucene indexesor remoteElasticsearch/OpenSearch indexes.
It features:
- Declarative mappingof entity properties to index fields,either through annotations or a programmatic API.
- On-demand mass indexingof all entities in the database,to initialize the indexes with pre-existing data.
- On-the-fly listener-triggered indexingof entities modified through a Hibernate ORM session,to always keep the indexes up-to-date.
- A Search DSLto easily build full-text search queriesand retrieve the hits as Hibernate ORM entities.
- And more:configuration of analyzers,many differentpredicatesandsortsin the Search DSL,spatial support.search queries returningprojectionsinstead of entities,aggregations,advanced customization of the mapping usingbridges,...
For example, map your entities like this:
@Entity// This entity is mapped to an index@IndexedpublicclassBook {// The entity ID is the document ID@Id@GeneratedValueprivateIntegerid;// This property is mapped to a document field@FullTextFieldprivateStringtitle;@ManyToMany// Authors will be embedded in Book documents@IndexedEmbeddedprivateSet<Author>authors =newHashSet<>();// Getters and setters// ...}@EntitypublicclassAuthor {@Id@GeneratedValueprivateIntegerid;// This property is mapped to a document field@FullTextFieldprivateStringname;@ManyToMany(mappedBy ="authors")privateSet<Book>books =newHashSet<>();// Getters and setters// ...}
Index existing data like this:
SearchSessionsearchSession =Search.session(entityManager );MassIndexerindexer =searchSession.massIndexer(Book.class );indexer.startAndWait();
Listener-triggered indexing does not require any change to code based on JPA or Hibernate ORM:
Authorauthor =newAuthor();author.setName("Isaac Asimov" );Bookbook =newBook();book.setTitle("The Caves Of Steel" );book.getAuthors().add(author );author.getBooks().add(book );entityManager.persist(author );entityManager.persist(book );
And search like this:
SearchResult<Book>result =Search.session(entityManager ) .search(Book.class ) .where(f ->f.match() .fields("title","authors.name" ) .matching("Isaac" ) ) .fetch(20 );List<Book>hits =result.hits();longtotalHitCount =result.total().hitCount();
This software and its documentation are distributed under the terms oftheApache License version 2.0 (Apache-2.0).
The Apache-2.0 license text is included verbatim in theLICENSE.txt filein the root directory of the repository.
Note that Hibernate Search 7.2.0.Alpha1 and lower are distributed under a different license;for more information, check the licensing information provided alongside published binaries,or thecorresponding branch in the source repository.
Getting started guides are availablehere.
Fore more information, refer to the Hibernate Search website:
- Available versions and compatibility matrix
- Reference documentation for all versions (current and past)
For offline use, distribution bundles downloaded fromSourceForgealso include the reference documentation for the downloaded version in PDF and HTML format.
Seehttps://hibernate.org/search/documentation/.
See the HSEARCH project on the Hibernate JIRA instance:https://hibernate.atlassian.net/browse/HSEARCH.
Seehttps://hibernate.org/community/.
New contributors are always welcome.
SeeCONTRIBUTING.md to get started.
The contribution guide also includes build instructions.
About
Hibernate Search: full-text search for domain model
Topics
Resources
License
Code of conduct
Contributing
Security policy
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Sponsor this project
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.