‘Hibernate Search By Example’ Book

Tweet about this on TwitterShare on Facebook0Share on Google+0Share on LinkedIn0Share on Reddit0Email this to someone

From the Preface of Hibernate Search by Example:

Over the past decade, users have come to expect software to be highly intelligent when searching data. It is no longer enough to simply make searches case-insensitive, look for keywords as substrings, or other such basic SQL tricks.

Hibernate Search book coverToday, when a user searches the product catalog on an e-commerce site, he or she expects keywords to be evaluated across all the data points. Whether a term matches the model number of a computer or the ISBN of a book, the search should still find all the possibilities. To help the user sort through a large number of results, the search should be smart enough to somehow rank them by relevance.

A search should be able to parse words and understand how they might be connected. If you search for the word development, then the search should somehow understand that this is related to developer, even though neither
of the words is a substring of the other.

Above all else, a search should be nice. When we post something in an online forum and mistake the words “there”, “they’re”, and “their”, people might only criticize our grammar. By contrast, a search should simply understand our typos and be cool about it! A search is at its best when it pleasantly surprises us, seeming to understand the real gist of what we’re looking for better than we understood it ourselves.

The purpose of this book is to introduce and explore Hibernate Search, a software package for adding modern search functionality to our own custom applications, without having to invent it from scratch. Because coders usually learn best by looking at real code, this book revolves around an example application. We will stick with this application as we progress through the book, fleshing it out as new concepts are introduced in each chapter.

Hibernate Search by Example is about an add-on for Hibernate ORM, allowing you to easily integrate Apache Lucene and Solr components to your Hibernate or JPA objects.  With Hibernate Search you can quickly and easily give your applications full-text search capability, accounting for typos, understanding and considering related terms, etc.

Two goals went into the writing of Hibernate Search by Example:

I didn’t want to make too many assumptions about the reader’s prior experience.  Knowledge of core Hibernate ORM is helpful… but if you’ve only had light or infrequent experience, or aren’t familiar with JPA, then the book provides enough background context to help you catch up.

I wanted to go deeper with the example code.  Rather than a collection of code snippets that illustrate ideas in a vacuum, all of the concepts are taught through a full-fledged example application.  Readers will have a working example app by the end of the first chapter, and it will continue to be enhanced along the way as new features are introduced.

Goodreads.com logo

See book reviews for Hibernate Search by Example at Goodreads.com

Example Application

The example application, the VAPORware Marketplace, is a fictional software “app store”.  It allows for searching across app names and descriptions, supported devices, and customer reviews.  The marketplace showcases Hibernate Search abilities around multiple search types, sorting, pagination, faceted search, projection-based queries without a database call, and more.

GitHub logo See a version of the source code on GitHub:https://github.com/steve-perkins/hibernate-search-demo
Heroku logo Play with a version of the live application, running on Heroku:http://hibernate-search-demo.herokuapp.com

Full Table of Contents for Hibernate Search by Example

Chapter 1 – Your First Application

  • Creating an entity class
  • Preparing the entity for Hibernate Search
  • Loading the test data
  • Writing the search query code
  • Selecting a build system
  • Setting up the project and importing Hibernate Search
  • Running the application
  • Summary

Chapter 2 – Mapping Entity Classes

  • Choosing an API for Hibernate ORM
  • Field mapping options
    • Multiple mappings for the same field
    • Mapping numeric fields
  • Relationships between entities
    • Associated entities
      • Querying associated entities
    • Embedded objects
  • Partial indexing
  • The programmatic mapping API
  • Summary

Chapter 3 – Performing Queries

  • Mapping API vs. query API
    • Using JPA for queries
    • Setting up a project for Hibernate Search and JPA
  • The Hibernate Search DSL
    • Keyword query
      • Fuzzy search
      • Wildcard search
    • Exact phrase search
    • Range query
    • Boolean (combination) queries
  • Sorting
  • Pagination
  • Summary

Chapter 4 – Advanced Mapping

  • Bridges
    • One-to-one custom conversion
      • Mapping date fields
      • Handling null values
      • Custom string conversion
        • StringBridge
        • TwoWayStringBridge
        • ParameterizedBridge
    • More complex mappings with FieldBridge
      • Splitting a string variable into multiple fields
      • Combining multiple properties into a single field
      • TwoWayFieldBridge
  • Analysis
    • Character filtering
    • Tokenization
    • Token filtering
    • Defining and selecting analyzers
      • Static analyzer selection
      • Dynamic analyzer selection
  • Boosting search result relevance
    • Static boosting at index-time
    • Dynamic boosting at index-time
  • Conditional indexing
  • Summary

Chapter 5 – Advanced Querying

  • Filtering
    • Creating a filter factory
      • Adding a filter key
    • Establishing a filter definition
    • Enabling the filter for a query
  • Projection
    • Making a query projection-based
    • Converting projection results to object form
    • Making Lucene fields available for projection
  • Faceted search
    • Discrete facets
    • Range facets
  • Query-time boosting
  • Placing time limits on a query
  • Summary

Chapter 6 – System Configuration and Index Management

  • Automatic vs. manual indexing
    • Individual updates
      • Adds and updates
      • Deletes
    • Mass updates
  • Defragmenting an index
    • Manual optimization
    • Automatic optimization
      • Custom optimizer strategy
  • Choosing an index manager
  • Configuring workers
    • Execution mode
    • Thread pool
    • Buffer queue
  • Selecting and configuring a directory provider
    • Filesystem-based
      • Locking strategy
    • RAM-based
  • Using the “Luke” utility
  • Summary

Chapter 7 – Advanced Performance Strategies

  • General tips
  • Running applications in a cluster
    • Simple clusters
    • Master-slave clusters
      • Directory providers
      • Worker backends
      • A working example
  • Sharding Lucene indexes
  • Summary

Buy Hibernate Search by Example from Amazon.com

  • Humoyun Ahmedov

    seems interesting