Multiple indexes in Opengrok

4.1k views Asked by At

How can we maintain two indexes for source code browsing with Opengrok? Normally opengrok provides option to index a single source tree. The website http://androidxref.com maintains multiple indexes corresponding to different versions of android. I would like to do something similar and index multiple repositories.

2

There are 2 answers

0
cdugz On

If I well understood your question, you want have separate indexes corresponding to separate source trees. For this, you will need to setup separate *.war app in webapp/ directory of your applictation server (tomcat, glassfish, etc). In README.txt, you have information about setup of basic source.war app ($OPENGROK_HOME/bin/OpenGrok deploy).

To serve separate index, you need copy webapp and tweak its contents - to point to new DATA_ROOT (generated by $OPENGROK_HOME/bin/OpenGrok index <abs_path_to_new_SRC_ROOT>). Remember that it will not be possbile to make "cross-instance" search queries.

Finally, the best place to address OpenGrok questions is here:

https://java.net/projects/opengrok/lists

0
Slek On

I guess I had the same need as yours.

First, you need a recent version of opengrok. I had to move from opengrok v0.11.1 to v0.12.1.2 (the latest as of today).

Take a look at the following page. It provides good hints to do the trick. https://github.com/OpenGrok/OpenGrok/wiki/How-to-install-OpenGrok#Optional_need_to_change_web_application_properties_or_name

You need to use the following environment variables when launching the indexing with the "OpenGrok" wrapper:

  • OPENGROK_WEBAPP_CONTEXT= <'name of your web app'>
  • OPENGROK_INSTANCE_BASE= <'alternate path to opengrok DATA_ROOT'>

Do not forget to rename the source.war file located in your servlet container (tomcat or other). In that file, change the CONFIGURATION field to the actual path of the opengrok configuration file (should be <'alternate path to opengrok DATA_ROOT'>/etc/configuration.xml).