1835

Can we create Lucene indexes only once at for initial set up only?

Question:

I am an newbie in Hibernate Search. According to Documentation

<blockquote>

<a href="http://docs.jboss.org/hibernate/search/3.4/reference/en-US/html_single/#d0e678" rel="nofollow">By default, every time an object is inserted, updated or deleted through Hibernate, Hibernate Search updates the according Lucene index.</a>

</blockquote>

As I learn till now I come to know that we can build the lucene index through programmatically like this :( correct me if I am wrong)

FullTextSession fullTextSession = Search.getFullTextSession(session); fullTextSession.createIndexer().startAndWait();

But what makes me surprise if is there is any way (and possible) to create indexes at initial set up only for once only.

Answer1:

If you start your application with an empty database (initially) there is no need to build the index. When you restart the application, the index is (by default) stored on filesystem so there is no need to rebuild the index.

This operation is meant to be used only when you lost the index (disk crash?), when you update the Hibernate Search or Lucene versions, when you restore a different database backup, or when you change the mapping of your entities: it can't detect automatically when it should run, so you're supposed to invoke the method explicitly.

The <em>MassIndexer</em> is also available as a JMX operation, which makes it very easy to invoke by an administrator without writing code, or in some cases I've simply created an "admin panel" in my web applications for people to operate when needed.

Recommend

  • Xcode 6: How to solve Precompile prefix Header error
  • Bash parameter expansion rules for backslash character
  • Preprocessor-IF doesn't work
  • High quality image re-sampling in Mono/C#/ASP.NET
  • Recursively defined nested types (in terms of incomplete types)
  • How to render two pd.DataFrames in jupyter notebook side by side?
  • How do I deselect all table rows in NSOutlineView when clicking in the empty space of the view?
  • How to put all my selected columns into a dummy variable?
  • Impossible to pass the router service to a twig extension in symfony 2.6
  • Get an index of a sorted matrix
  • mysql and indexes with more than one column
  • List images(01.png) and descriptions(01.txt) from directory
  • Instantiate interface in JAVA?
  • Sequential (transactional) API calls in angular 4 with state management
  • Access Android Market through SSH tunnel
  • Insert new calendar with SyncAdapter- Calendar API Android
  • xtable package: Skipping some rows in the output
  • How integrated is Collada to OpenGL ES
  • Get history of file changes from TFS to implement custom “blame”-behaviour of exceptions
  • Blackberry - Custom EditField Cursor
  • Test if a set exists before trying to drop it
  • D3 nodes and links from JSON with nested arrays of children
  • How to create a file in java without a extension
  • Alert pop up with LWUIT
  • NHibernate Validation Localization with S#arp Architecture
  • ilmerge with a PFX file
  • Java Scanner input dilemma. Automatically inputs without allowing user to type
  • Adding a button at the bottom of a table view
  • C# - Is there a limit to the size of an httpWebRequest stream?
  • Read text file and split every line in MSBuild
  • req.body is undefined - nodejs
  • Counter field in MS Access, how to generate?
  • Get object from AWS S3 as a stream
  • Java applet as stand-alone Windows application?
  • MySQL WHERE-condition in procedure ignored
  • Adding custom controls to a full screen movie
  • Comma separated Values
  • Error creating VM instance in Google Compute Engine
  • Hits per day in Google Big Query
  • how does django model after text[] in postgresql [duplicate]