Hibernate Search by Example

Hibernate Search by Example
eBook: $17.99
Formats: PDF, PacktLib, ePub and Mobi formats
save 15%!
Print + free eBook + free PacktLib access to the book: $47.98    Print cover: $29.99
save 37%!
Free Shipping!
UK, US, Europe and selected countries in Asia.
Also available on:
Table of Contents
Sample Chapters
  • Add search capability to your custom applications
  • Integrate with the core Hibernate system, using traditional APIs or JPA
  • Write search queries in no time that may be simple or complex

Book Details

Language : English
Paperback : 148 pages [ 235mm x 191mm ]
Release Date : March 2013
ISBN : 184951920X
ISBN 13 : 9781849519205
Author(s) : Steve Perkins
Topics and Technologies : All Books, Application Development, Open Source

Table of Contents

Chapter 1: Your First Application
Chapter 2: Mapping Entity Classes
Chapter 3: Performing Queries
Chapter 4: Advanced Mapping
Chapter 5: Advanced Querying
Chapter 6: System Configuration and Index Management
Chapter 7: Advanced Performance Strategies
  • 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 versus 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 query
          • 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
            • More complex mappings with FieldBridge
              • Splitting a single 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 an 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 versus 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

                Steve Perkins

                Steve Perkins is a Java developer based in Atlanta, GA, USA. Steve has been working with Java in a web and systems integration context for 15 years, for clients ranging from commerce and finance to media and entertainment. He has been using Hibernate intensively for over seven years, and is interested in best practices for data modeling and application design.

                Apart from coding, Steve also has a keen interest in the subject of software patents, which eventually led to a law degree and becoming a licensed attorney. Steve co-authored In the Aftermath of In re Bilski, published in 2009, and In the Aftermath of Bilski v. Kappos, published in 2010, for the Practicing Law Institute Handbook Series.

                Steve lives in Atlanta with his wife, Amanda, their son, Andrew, and more musical instruments than he has free time to play. You can visit his website at steveperkins.net and follow him on Twitter at @stevedperkins.

                Sorry, we don't have any reviews for this title yet.

                Code Downloads

                Download the code and support files for this book.

                Submit Errata

                Please let us know if you have found any errors not listed on this list by completing our errata submission form. Our editors will check them and add them to this list. Thank you.

                Sorry, there are currently no downloads available for this title.

                Frequently bought together

                Hibernate Search by Example +    Getting Started with Citrix VDI-in-a-Box =
                50% Off
                the second eBook
                Price for both: $26.00

                Buy both these recommended eBooks together and get 50% off the cheapest eBook.

                What you will learn from this book

                • Make core Hibernate entity classes searchable, no matter which mapping API they use
                • Write different kinds of search queries by keyword, exact phrase, “fuzzy” search, or searching within a range
                • Sort search results by various criteria
                • Use pagination to work with and display search results one chunk at a time
                • Define custom analyzers to help searches adjust for user typos and recognize related terms
                • Fine-tune the relevance of search results through boosting
                • Apply conditional indexing logic to exclude certain data from being searchable
                • Make Hibernate Search aware of relationships for searches involving data points spread out over multiple classes

                In Detail

                Users expect software to be highly intelligent when searching data. Searches should span across multiple data points at once, and be able to spot patterns and groupings in the results found. Searches should be able to fix user typos, and use terms related to the user’s search words. Searching 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! Where can we find such a search system and how can we use it efficiently?

                Hibernate Search by Example is a practical, step-by-step tutorial, which guides you from the basics of Hibernate Search to its advanced features. The book builds toward a complete sample application, slowly fleshed out to demonstrate each and every concept being introduced in each chapter. By the end you will have a solid foundation for using Hibernate Search in real production applications.

                This book starts with a simple example, and incrementally builds upon it to showcase each Hibernate Search feature introduced. By the end of the book you will have a working, functionality-rich application, and a deeper understanding than you might have had from looking at code snippets in a vacuum.

                You will learn how to integrate search into core Hibernate applications, whether they are XML or annotation-based, or if you are using JPA. You will see how to fine-tune the relevance of search results, and design searches that can account for user typos or automatically reach for related terms. We will take advantage of performance optimization strategies, from running Hibernate Search in a cluster to reducing the need for database access at all.

                Hibernate Search by Example provides everything you need to know to incorporate search functionality into your own custom applications.


                A step-by-step guide for getting started with Hibernate Search, employing a practical example application that will make readers quickly learn and use the excellent search capabilities that the Hibernate Search tool offers.

                Who this book is for

                This book is for any Java developer who wants to quickly and easily add feature-rich search capabilities to his/her custom applications. It is assumed that readers will have experience in Java development, and understand some basic relational database concepts. However, while core Hibernate experience is very helpful, it is not necessarily required.

                Code Download and Errata
                Packt Anytime, Anywhere
                Register Books
                Print Upgrades
                eBook Downloads
                Video Support
                Contact Us
                Awards Voting Nominations Previous Winners
                Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
                Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software