• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Hibernate Search In Action- new index in existing directories?

 
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Does Hibernate Search aid in creating new indexes in existing directories?

OR

is it always done at the startup, when a complete B Tree like structure is generated and maintained and kept in cache for cache hits and quick access.

How is the index sync maintained? and how are the index conflicts handled?
 
author
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It is not a b-tree index but what is called an inverted index. The key in the index is roughly words in a text.

Here is how it works, every time Hibernate Core does create, update or delete an entity, Hibernate Search knows about it (by listening to the event system) and transparently updates the Lucene index (or indexes) for you. So at a given time the index is always up to date with the database.
Lucene indexes are generally stored in a file system directory and hence are persistence across restart of the application. There are some other index storage strategies but FS is the most common one.

To initially index the data from your database when you initially add Hibernate Search into your application, Hibernate Search does provide a manual API to index or purge your index (ie wo waiting for Hibernate Core change events).
 
Dinesh Sundrani
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Emmanuel, I got the idea of an inverted index!

But doesn't updating the index via those listerners each and every time slows up the search? Because I would prefer a search engine that is very quick and efficient rather than 'very-super' precisive in getting me the return list for iteration.

Do we have a batch based updation system also, where say, we can run it to sync-up the index data-structure (the file system directory) every night from 3AM to 4AM, where the server is in a zombie mode with seldom any hits or activity
 
Emmanuel Bernard
author
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In most cases, people don't see performance degradation. This is particularly true if you use the JMS cluster mode.
In this approach, the indexing is done on a master without affecting your slaves. Slaves do answer queries very fast thanks to their local copy of the index and push changes to the master. The master does the indexing and on a regular basis (configurable), the new index is pushed to slaves.

I describes that in chapter 5 and 10.

But be sure to not pre-suppose you need optimization wo really trying. Premature optimization is the root of all evil
 
reply
    Bookmark Topic Watch Topic
  • New Topic