Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to ignore directories in OpenGrok index?

Tags:

opengrok

I am trying to setup OpenGrok to search through a few GB of code, mostly Java and Python projects. I use opengrok-0.12.1/bin/OpenGrok index $SRC_ROOT to build the index. I can see it indexing Java's "target" and Python's ".tox" directories which I don't need.

I searched online and found the same question in many forums, and the answer being to use -i. I have tried to use this option with both the OpenGrok wrapper script as well as opengrok.jar, but all I get is the help message (because the command line options were apparently wrong).

Could you give me an example command to build indices that ignore certain directories?

like image 621
bsravanin Avatar asked Mar 11 '15 22:03

bsravanin


2 Answers

The solution is to use the -i flag. The best way to do this is to create a .conf file. For example, I have the following file defined as opengrok.conf:

OPENGROK_APP_SERVER=Tomcat
OPENGROK_TOMCAT_BASE=/usr/local/Cellar/tomcat/8.0.21/libexec
OPENGROK_SCAN_DEPTH=4
OPENGROK_VERBOSE=yes
OPENGROK_PROGRESS=yes
IGNORE_PATTERNS="-i f:foo.txt -i *.bar -i d:target -i d:.tox"

And run the indexing using: OPENGROK_CONFIGURATION=opengrok.conf ./OpenGrok index $SRC_ROOT

It ignores indexing the file foo.txt, all files that match the pattern *.bar, and all files in directories named target or .tox.

Edit credits: mrenaud, pcas

like image 69
bsravanin Avatar answered Oct 12 '22 00:10

bsravanin


Note that https://github.com/oracle/opengrok/pull/1841 renamed IGNORE_PATTERNS to OPENGROK_IGNORE_PATTERNS (in Oct 2017).

like image 35
Paul Healy Avatar answered Oct 12 '22 00:10

Paul Healy