Giter VIP home page Giter VIP logo

hibernate-search's Introduction

Hibernate Search

Maven Central Build Status Sonar Coverage Quality gate

Description

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

It features:

For example, map your entities like this:

@Entity
// This entity is mapped to an index
@Indexed
public class Book {

    // The entity ID is the document ID
    @Id
    @GeneratedValue
    private Integer id;

    // This property is mapped to a document field
    @FullTextField
    private String title;

    @ManyToMany
    // Authors will be embedded in Book documents
    @IndexedEmbedded
    private Set<Author> authors = new HashSet<>();

    // Getters and setters
    // ...
}

@Entity
public class Author {

    @Id
    @GeneratedValue
    private Integer id;

    // This property is mapped to a document field
    @FullTextField
    private String name;

    @ManyToMany(mappedBy = "authors")
    private Set<Book> books = new HashSet<>();

    // Getters and setters
    // ...
}

Index existing data like this:

SearchSession searchSession = Search.session( entityManager );
MassIndexer indexer = searchSession.massIndexer( Book.class );
indexer.startAndWait();

Automatic indexing does not require any change to code based on JPA or Hibernate ORM:

Author author = new Author();
author.setName( "Isaac Asimov" );

Book book = new Book();
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();
long totalHitCount = result.total().hitCount();

License

This software and its documentation are distributed under the terms of the GNU Lesser General Public License (LGPL), version 2.1 or later.

See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html.

Getting started

A getting started guide is available in the reference documentation.

Fore more information, refer to the Hibernate Search website:

For offline use, distribution bundles downloaded from SourceForge also include the reference documentation for the downloaded version in PDF and HTML format.

Contact

Latest Documentation

See http://hibernate.org/search/documentation/.

Bug Reports

See the HSEARCH project on the Hibernate JIRA instance: https://hibernate.atlassian.net/browse/HSEARCH.

Community Support

See http://hibernate.org/community/.

Contributing

New contributors are always welcome.

See CONTRIBUTING.md to get started.

The contribution guide also includes build instructions.

hibernate-search's People

Contributors

yrodiere avatar sanne avatar fax4ever avatar hferentschik avatar emmanuelbernard avatar gsmet avatar gunnarmorling avatar davided avatar dependabot[bot] avatar marko-bekhta avatar hibernate-ci avatar mincong-h avatar wklaczynski avatar s4ke avatar golovnin avatar davidedisomma avatar stliu avatar acucumel avatar anistor avatar carstenartur avatar frekele avatar michael-simons avatar zackurey avatar mbppower avatar sant0s avatar rnveach avatar abrin avatar ttretter avatar voidfist avatar mathpere avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.