Apache Lucene™ Integration Reference Guide

Apache Lucene™ Integration Reference Guide

Hibernate Search Apache Lucene™ Integration Reference Guide 5.2.1.Final by Emmanuel Bernard, Hardy Ferentschik, Gustavo Fernandes, Sanne Grinovero, Nabeel Ali Memon, and Gunnar Morling Preface ............................................................................................................................ vii 1. Getting started ............................................................................................................. 1 1.1. System Requirements ......................................................................................... 1 1.2. Migration notes ................................................................................................... 1 1.3. Required libraries ................................................................................................ 2 1.3.1. Using Maven ........................................................................................... 2 1.3.2. Manual library management ...................................................................... 3 1.4. Deploying on WildFly .......................................................................................... 3 1.5. Configuration ...................................................................................................... 3 1.6. Indexing ............................................................................................................. 7 1.7. Searching ........................................................................................................... 7 1.8. Analyzer ............................................................................................................. 8 1.9. What’s next ...................................................................................................... 10 2. Architecture ............................................................................................................... 13 2.1. Overview .......................................................................................................... 13 2.2. Back end .......................................................................................................... 14 2.2.1. Lucene .................................................................................................. 14 2.2.2. JMS ....................................................................................................... 15 2.2.3. JGroups ................................................................................................. 17 2.3. Reader strategy ................................................................................................ 17 2.3.1. shared ................................................................................................... 17 2.3.2. not-shared ............................................................................................. 17 2.3.3. Custom .................................................................................................. 18 3. Configuration ............................................................................................................. 19 3.1. Enabling Hibernate Search and automatic indexing ............................................. 19 3.1.1. Enabling Hibernate Search ..................................................................... 19 3.1.2. Automatic indexing ................................................................................. 19 3.2. Configuring the IndexManager ........................................................................... 19 3.2.1. directory-based ...................................................................................... 20 3.2.2. near-real-time ......................................................................................... 20 3.2.3. Custom .................................................................................................. 20 3.3. Directory configuration ....................................................................................... 20 3.3.1. Infinispan Directory configuration ............................................................. 25 3.4. Worker configuration ......................................................................................... 27 3.4.1. JMS Master/Slave back end ................................................................... 30 3.4.2. JGroups Master/Slave back end .............................................................. 32 3.5. Reader strategy configuration ............................................................................ 35 3.6. Exception handling ............................................................................................ 36 3.7. Lucene configuration ......................................................................................... 36 3.7.1. Tuning indexing performance .................................................................. 37 3.7.2. LockFactory configuration ....................................................................... 42 3.7.3. Index format compatibility ....................................................................... 44 3.8. Metadata API .................................................................................................... 45 3.9. Hibernate Search as a WildFly module ............................................................... 45 iii Hibernate Search 3.9.1. Use the Hibernate Search version included in WildFly ............................... 45 3.9.2. Update and activate latest Hibernate Search version in WildFly ................. 46 3.9.3. Using Infinispan with Hibernate Search on WildFly ................................... 47 4. Mapping entities to the index structure ..................................................................... 49 4.1. Mapping an entity ............................................................................................. 49 4.1.1. Basic mapping ....................................................................................... 49 4.1.2. Mapping properties multiple times ........................................................... 55 4.1.3. Embedded and associated objects .......................................................... 56 4.1.4. Associated objects: building a dependency graph with @ContainedIn ......... 62 4.2. Boosting ........................................................................................................... 63 4.2.1. Static index time boosting ....................................................................... 63 4.2.2. Dynamic index time boosting .................................................................. 63 4.3. Analysis ............................................................................................................ 65 4.3.1. Default analyzer and analyzer by class .................................................... 65 4.3.2. Named analyzers ................................................................................... 66 4.3.3. Dynamic analyzer selection ..................................................................... 71 4.3.4. Retrieving an analyzer ............................................................................ 72 4.4. Bridges ............................................................................................................. 73 4.4.1. Built-in bridges ....................................................................................... 74 4.4.2. Tika bridge ............................................................................................ 75 4.4.3. Custom bridges ...................................................................................... 76 4.4.4. BridgeProvider: associate a bridge to a given return type .......................... 82 4.5. Conditional indexing .......................................................................................... 84 4.6. Providing your own id ....................................................................................... 87 4.6.1. The ProvidedId annotation ...................................................................... 87 4.7. Programmatic API ............................................................................................. 87 4.7.1. Mapping an entity as indexable ............................................................... 89 4.7.2. Adding DocumentId to indexed entity ...................................................... 90 4.7.3. Defining analyzers .................................................................................. 91 4.7.4. Defining full text filter definitions .............................................................. 92 4.7.5. Defining fields for indexing ...................................................................... 93 4.7.6. Programmatically defining embedded entities ........................................... 95 4.7.7. Contained In definition ............................................................................ 96 4.7.8. Date/Calendar Bridge ............................................................................. 97 4.7.9. Declaring bridges ................................................................................... 98 4.7.10. Mapping class bridge ............................................................................ 99 4.7.11. Mapping dynamic boost ...................................................................... 100 5. Querying .................................................................................................................. 103 5.1. Building queries .............................................................................................

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    184 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us