EIC Code Browsing Server
Notes
Example of freetext search in LXR
Suppose the aim is to find *.cxx files with "CBNT" in the name
and "CBNTAA" in the body. Then fill "Files named" with
"CBNT.*\.cxx and "Containing" with "CBNTAA".
Make sure that "allow perl regex" option is checked. See details below.
Note about freetext search
The freetext search is powered by Glimpse
that supports variety
of patterns, including simple strings, strings with classes of
characters, sets of strings, wild cards, and regular expressions
The freetext search can be started by clicking on "general search"
button in the upper right corner of the
main LXR page.
Two fillable fields then appear in the window: "Files named" and
"Containing". You can search for filenames with particular
strings/patterns or for files containing particular strings/patterns.
The Caveats are:
- The "File named" field can not be empty. If you wish to find
all files containing abc then enter "." in the "File named"
field and "abc" in the "Containing" field.
- If "Advanced (allow perl regex)" option is not checked then
no symbol in the pattern is treated as a meta character (the only exception
is ^ at the beginning of the pattern and $ at the end of the pattern,
which are still interpreted in the usual way. Use \^ or \$ if you need
them verbatim). Therefore
"." means literally dot in the file name. If however "Advanced"
is checked then "." matches any symbol in the file name.
The syntax of regular expressions in glimpse is in general the same as
that for agrep (a variation of grep developed by the author of
Glimpse). The following special characters ( `$', `^', `*', `[', `^', `|', `(', `)', `!', and `\' ) as well as
the following meta characters special to glimpse (and agrep): `;', `,', `#', `<', `>', `-', and `.', should
be preceded by `\' if they are to be matched as regular characters
- For "Containing" field only: Glimpse supports `AND'
operation denoted by the symbol `;' and
`OR' operation denoted by the symbol `,', 'NOT' operation denoted
by the symbol `~', or any combination. For example, you can enter
"a0;z0;phi" in the "Containing" field to search for
files with all three patterns
- The maximum length of string in "Containing" field is 30
characters. This limitation comes from agrep ("approximate grep") tool which is the search engine for glimpse. See
agrep wikipedia page
for interesting details
- WARNING NOTE for simple text pattern searches in files with
a certain name: at first the LXR finds all files with the indicated text
pattern and then selects the files with matching names. The problem
can occur because the maximum number of text search hits is set to 1000.
If the limit
is reached then the result of the text search of a text pattern in files with
a certain name becomes incomplete (and no warning is displayed in this case).
The following recipe can help to avoid confusion:
- search for the pattern in all files (i.e. with empty field "Files named")
- check if number of hits is less then 1000
- perform the desired search for the files with a certain name
- It was noticed that Glimpse can have problems with "<", ">"
in xml files. For instance searching files containing "\<.*hep.*"
provides satisfactory results while searching ".*hep.*" does not
work (for xml files only; works for other files)
- Glimpse makes an effort to identify non-text files such as binary files,
compressed files, uuencoded files, postscript files, binhex files, etc.
Unfortunately sometimes good files are discarded, e.g. genuine text files
with long strings without spaces. To prevent this all python files (with extension .py) are
included in general search index.