Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 365355
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T13:31:45+00:00 2026-05-12T13:31:45+00:00

I just started integrating Hibernate Search with my Hibernate application. The data is indexed

  • 0

I just started integrating Hibernate Search with my Hibernate application. The data is indexed by using Hibernate Session every time I start the server.

FullTextSession fullTextSession = Search.getFullTextSession(session);
Transaction tx = fullTextSession.beginTransaction();

List books = session.createQuery("from Book as book").list();
for (Book book : books) {
    fullTextSession.index(book);
}

tx.commit(); //index is written at commit time     

It is very awkward and the server takes 10 minutes to start.
Am I doing the this in right way?

I wrote a scheduler which will update the indexes periodically. Will this update the existing index entries automatically, or create duplicate indices?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T13:31:45+00:00Added an answer on May 12, 2026 at 1:31 pm

    As detailed in the Hibernate Search guide, section 3.6.1, if you are using annotations (by now the default), the listeners which launch indexing on store are registered by default:

    Hibernate Search is enabled out of the
    box when using Hibernate Annotations
    or Hibernate EntityManager. If, for
    some reason you need to disable it,
    set
    hibernate.search.autoregister_listeners
    to false.

    An example on how to turn them on by hand:

     hibConfiguration.setListener("post-update", new FullTextIndexEventListener());
     hibConfiguration.setListener("post-insert", new FullTextIndexEventListener());
     hibConfiguration.setListener("post-delete", new FullTextIndexEventListener());
    

    All you need to do is annotate the entities which you want to be indexed with the

    @Indexed(index = "fulltext")
    

    annotation, and then do the fine-grained annotation on the fields, as detailed in the user guide.

    So you should neither launch indexing by hand when storing, neither relaunch indexing whae the application starts, unless you have entities which have been stored before indexing was enabled.

    You may get performance problems when you are storing an object which say has an “attachment” and so you are indexing that in the same scope of the transaction which is storing the entity. See here:

    Hibernate Search and offline text extraction

    for a solution that solves this problem.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Just started with Sencha today and found it a bit overwhelming. Was able to
I'm very new to ANT and have started using it in a Flash Builder
Just started learning how to use paper_clip. I installed everything according the instructions and
I'm developing an application that will randomize a list of words, and display them
I'm using Zend Framework and I feel that I need a good ORM to
I am looking at SpecFlow examples, and it's MVC sample contains several alternatives for
Really two questions: If I have a dictionary (that originally came from parsing a
I have a small project which will use iPad as an information kiosk for
More of an architecture / long-term view question. I'm in the process of putting
do you know why the DragDrop event in F# is not working properly in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.