Skip to content

Indexer configuration

Vladimir Kotal edited this page Mar 26, 2020 · 49 revisions

Indexer tunables

This is a list of the most common configuration options with their defaults which are not available as an indexer switch. These options are particularly handy when working with https://github.com/oracle/opengrok/wiki/Read-only-configuration

Tunable Type Since version Meaning
fetchHistoryWhenNotInCache boolean XXX avoid generating history for individual files when indexing. This prevents excess commands if the history log for top-level directory of a project cannot be retrieved for some reason (e.g. the command to get the history log fails) at the cost of not having history for given project available (if projects are enabled). This is specific to SCMs that can generate history for directories (e.g. Mercurial, Git, ...).
ctags String XXX path to Universal ctags binary. If the path is not specified in configuration, the system path will be searched and if no Universal ctags binary is found, the system property org.opengrok.indexer.analysis.Ctags will be checked and will be used if non empty.
ctagsTimeout long - number of seconds 1.3.2 timeout for processing of a file by the ctags program; if the definitions are not returned within this timeout the ctags process is terminated, default 10 seconds
disabledRepositories list of disabled repository types 1.3.6 disable given repository types. This can also be set with the --disableRepository Indexer option. When setting this up in configuration, use the add method for strings.

Other Indexer configuration

Custom ctags configuration

To make ctags recognize additional symbols/definitions/etc. it is possible to specify configuration file with extra configuration options for ctags.

This can be done by using the -o Indexer option.

Sample configuration file for Solaris code base:

--regex-asm=/^[ \t]*(ENTRY_NP|ENTRY|RTENTRY)+\(([a-zA-Z0-9_]+)\)/\2/f,function/
--regex-asm=/^[ \t]*ENTRY2\(([a-zA-Z0-9_]+),[ ]*([a-zA-Z0-9_]+)\)/\1/f,function/
--regex-asm=/^[ \t]*ENTRY2\(([a-zA-Z0-9_]+),[ ]*([a-zA-Z0-9_]+)\)/\2/f,function/
--regex-asm=/^[ \t]*ENTRY_NP2\(([a-zA-Z0-9_]+),[ ]*([a-zA-Z0-9_]+)\)/\1/f,function/
--regex-asm=/^[ \t]*ENTRY_NP2\(([a-zA-Z0-9_]+),[ ]*([a-zA-Z0-9_]+)\)/\2/f,function/

Introduce own mapping for an extension to analyzer

Use the -A Indexer option, e.g. to make files with the .cs suffix to be processed as plain text:

-A .cs:org.opengrok.indexer.analysis.plain.PlainAnalyzerFactory

This will map extension .cs to the analyzer created by the PlainAnalyzerFactory . You should even be able to override OpenGroks analyzers using this option.

OpenGrok also allows using just the prefix. E.g. the following are all equivalent:

-A .e:org.opengrok.indexer.analysis.c.CAnalyzerFactory
-A .e:CAnalyzerFactory
-A .e:CAnalyzer
-A .e:C

To clear the mapping:

-A .e:-

so that the plain-text heuristic is active as a fallback for .e files. Or you could explicitly map the PlainAnalyzerFactory:

-A .e:Plain

(N.b. the case-sensitivity of the class name.)