Overview
This page documents the use of admin tools to rebuild the Lucene index. Indexes are created based on the hibernate-search annotations on model objects such as @Indexed, @IndexedEmbedded, @Field, @ContainedIn, etc.
Prerequisites
For this mojo to run, the file system directory specified by the "hibernate.search.default.indexBase" must exist.
Details
This tool is used to rebuild Lucene indexes for objects indexed by the system.
Indexes are written into the directory specified by the hibernate.search.default.indexBase property in the
Following are some details about the implementation of this tool:
Mojo: LuceneReindexMojo.java (in admin/mojo/src/main/resources/java/org/ihtsdo/otf/mapping/mojo)
Project: admin/lucene
Configuration Parameters
- run.config - the standard configuration file
- indexedObjects - optional parameter that allows only some indexes to be rebulit (e.g. MapRecordJpa).
% cd mapping-parent/admin/lucene % mvn -Drun.config=/home/ihtsdo/data/config.properties clean install |
- Optional parameter: indexedObjects. Supports a comma-separated list (no spaces) if only certain types of objects need to be indexed. Example follows:
# Re-indexes only map records and tracking records % cd mapping-parent/admin/lucene % mvn -Drun.config=/home/ihtsdo/data/config.properties -DindexedObjects=MapRecordJpa,TrackingRecordJpa clean install
|
Samples
Sample command line call of the admin tool to rebuild all indexes:
% cd mapping-parent/admin/lucene % mvn -Drun.config=/home/ihtsdo/data/config.properties install
Sample command line call of the admin tool to reindex only certain data structures:
# Re-indexes only map records and tracking records % cd mapping-parent/admin/lucene % mvn -Drun.config=/home/ihtsdo/data/config.properties -DindexedObjects=MapRecordJpa,TrackingRecordJpa install
Sample Eclipse run configuration:
Troubleshooting
Sometimes issues arise with the indexes (in particular when running admin tools while the Tomcat server is also running). Occasionally it is necessary to completely reindex all objects from scratch. When this is needed, the recommended approach is to remove the index files from the index and then run this mojo. For example, to guarantee a clean index rebuild, you could do this:
# stop the server % service tomcat7 stop # remove the indes % /bin/rm -rf /var/lib/tomcat7/indexes/lucene/indexes/*MapRecordJpa # rebuild the index % cd mapping-parent/admin/lucene % mvn -Drun.config=/home/ihtsdo/data/config.properties -DindexedObjects=MapRecordJpa install
References/Links
- n/a