views:

314

answers:

9

I'm doing maintenance of a few branches of middle-size C++ project (~15k files for each branch). Very often I have to search all project files for given string or regex. Currently I'm using Total Commander which has all features I want (case-sensitive, regexes, filename masks) but this tool scans all files every time, so it takes a bit too much time.

Do you know any text search tool, which could pre-index whole source tree and allow quick pattern finding? Returning all matching files is a must, preview of found pattern surroundings would be nice. Of course indexes must be updated instantly when something changes.

Visual Studio search is not enough, it only scans source files (not metadata nor custom resources).

Does such tool exists? I'm using Windows XP.

EDIT: I've found very usable tool, see my own answer

A: 

One straightforward way to sidestep the problem is to put all the source code on a RAM disk. By speeding up the file IO in this way, you'll see a big jump in performance without otherwise changing your tool chain.

Will
Will not necessarily help. All modern OSes cache disk access anyway, so after the first search the stuff will already be in RAM.
sleske
~500 MB sources per branch - too big to keep a few branches in RAM-disk (WinXP 32bit), too big to copy on demand.
tomash
+1  A: 

cscope is able to index c files and to some extent c++ as well. I personally use the KDE front-end KScope which is user-friendlier than cscope's ui.

apart from that you might want to have a look at OpenGrok

Philipp
Windows solution is needed, question edited. Also all files must be searched (also binary-alike), not only source code files.
tomash
A: 

Please see http://aaron.oirt.rutgers.edu/myapp/docs/W1300.testAndDemo and follow the "search demo" link to the code tree search demo.
This will do exactly what you are asking for and it is a standard demo component of WHIFF. You will have to add Pygments plug ins to pull out strings of interest from your binary files (or just read the whole file as 'text') -- out-of-the-box the indexer will ignore files Pygments doesn't recognize. There is an easy hack to make it "eat everything" -- let me know if you want more info.

The installation and command line interfaces for searching are described at http://aaron.oirt.rutgers.edu/myapp/docs/W1300_1000.search.

Aaron Watters
Unfortunately, web application is not what I'm looking for.
tomash
Actually, the web interface is just a facade. There are command line interfaces too.
Aaron Watters
A: 

You could try Google desktop search, or how about Lucene or clucene (lucene ported to c++) as a general-purpose indexing tool.

gbjbaanb
Does google desktop search suppors restricting indexing to selected directory, allows multiple databases, regex searching and so on?
tomash
A: 

I know you don't want a webapp necessarily, but try Open Grok.

florin
A: 

Windows Indexing Service appears to match all your criteria.

Boo
+1  A: 

I don't know for sure (I have no experience), but I would give Eclipse CDT a try. It indexes all your sources for fast lookup of symbols, similar to Eclipse JDT (Java tools).

Peter Štibraný
+2  A: 

I found very usable tool here: http://code.google.com/p/ndexer/

I recommend it to everyone!

tomash
A: 

See http://www.semanticdesigns.com/Products/SearchEngine/index.html for a search engine that preindexes code according to its langauge elements (identifiers, strings, keywords, numbers, operators, comments) and provides a query langauge over matching elements. By hunting for identifiers using wildcards, you skip over all similar character sequecnes in in comments and strings. Provides list of hits; single click on a hit to see the source code containg the hit.

Ira Baxter