什么是好的源代码搜索引擎?

发布于 2024-07-05 22:14:57 字数 1477 浏览 10 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(11

孤独患者 2024-07-12 22:14:57

如果您有那么多源代码,您可能需要花一些时间来设置搜索引擎来为其建立索引。 我会推荐 Lucene - 它免费,速度快,对于任何有编程经验的人来说,为任何内容设置强大的索引都非常容易。

http://lucene.apache.org/

If you have that much source code, you may need to put a bit of time into setting up a search engine to index it. I would recommend Lucene - its free, its fast, it is is pretty easy to set up a powerful index on any content for anyone with programming experience.

http://lucene.apache.org/

池予 2024-07-12 22:14:57

我推荐 OpenGrok。 还有一些其他引擎,这里是快速回顾一下它们。

I recommend OpenGrok. There are some other engines, here's a quick review of them.

妄司 2024-07-12 22:14:57

20分钟太离谱了! 这些天我正在处理超过一百万行的源代码库,grep 最多需要几秒钟(我使用 ack)。 我们的主目录存储在文件服务器上并通过 NFS 挂载,为了加快 grep 速度,我们在登录到文件服务器时执行此操作。 我不确定 NFS 需要多长时间,但肯定更长。

出于相同的性能原因,我们还在登录文件服务器时执行源代码控制操作。

20 minutes is outrageous! I'm working with a million+ line source code base these days and grepping takes a few seconds at most (I use ack). Our home directories are stored on a file server and mounted over NFS, and to speed up grepping we do that while logged in to the file server. I'm not sure how long it takes over NFS, but it's certainly longer.

We also do source control operations while logged in to the file server, for the same performance reasons.

阳光的暖冬 2024-07-12 22:14:57

Lxr 在大型代码库上运行良好,正如 Linux 内核。 我认为它仅适用于 C (您没有指定使用的语言)。

Lxr works great on big code bases, as proved with the linux kernel. I think it's only for C (you didn't specify the languages used).

雨的味道风的声音 2024-07-12 22:14:57

在 Linux 上,我使用 GNU ID Utils 这些与 grep 具有类似的功能,但通过索引工作所以它们的速度快得令人难以置信。 您运行 mkid 来创建索引,然后运行其他实用程序之一,例如“gid”,它是 grep 到 grep 整个索引的 ID 工具版本。 我有一个偶尔运行 mkid 的 cron 作业。

ID 工具也可以在 Windows 上使用,可以与 cygwin 一起使用,也可以作为标准 Windows 程序

On Linux I use the GNU ID Utils These have similar functions to grep but work from an index so they are incredibly fast. You run mkid to create an index and then one of the other utilities such as "gid" which is the ID Tools version of grep to grep across the index. I have a cron job that runs mkid occasionally.

The ID tools work on Windows as well, either with cygwin or as a standard windows program

负佳期 2024-07-12 22:14:57

我以前使用过 OpenGrok,并且对它非常满意。
另一种选择是:

Gonzui
http://gonzui.sourceforge.net/screenshots.html

< /a>
(来源:
sourceforge.net

I have used OpenGrok before and was quite happy with it.
Another alternative is:

Gonzui
http://gonzui.sourceforge.net/screenshots.html


(source: sourceforge.net)

白鸥掠海 2024-07-12 22:14:57

我使用 cs2project 一段时间了,它是一个基于Lucene.NET。 不幸的是它不再被开发。

I've used cs2project for a while, it's an open source c# code search engine based on Lucene.NET. Unfortunately it's no longer being developed.

假装爱人 2024-07-12 22:14:57

既然你说的是“grepping”,我想你对命令行解决方案不会不感兴趣。

ctags 这样的工具将索引和搜索 C# 和 JavaScript 代码库(以及许多其他代码库)。

ctags 的巧妙之处在于,它可以与 vim 结合使用 taglist 插件以允许源代码浏览,或与 vimomnicomplete 结合使用以启用代码完成。

Since you're saying 'grepping' I imagine you're not disinterested in command-line solutions.

A tool like ctags will index and search C# and JavaScript codebases (among many others).

What's very neat about ctags is that it can be combined with vim with either the taglist plugin to allow source code browsing or with vim omnicomplete to enable code completion.

寄居者 2024-07-12 22:14:57

我有类似的问题。 我在一家软件公司工作,项目涉及c#、c++、asp.net、db脚本甚至vb6源代码(是的,当没有像更高版本的Visual Studio那样的解决方案概念时,编译多个vb6项目是一件令人头痛的事情。 ..)

我一直在使用 Visual Studio 2010,但必须使用第 3 方文本编辑器来搜索 db 脚本和 vb6 源代码。

我做了一些研究并发现了 KodeEx (http://kodeex.com) 并且对此感到满意。 它是一个基于索引的源代码搜索工具。 您不必构建任何东西(就像其他人建议您使用 Lucene 所做的那样。顺便说一下,Lucene 是一个很好的开源项目 =) )。 只需安装它并让它索引您的项目即可。 之后,它通常会在几秒钟内返回结果。

I had a similar problem. I work for a software company where the project involves c#, c++, asp.net, db scripts and even vb6 source code (yeah it is a headache compiling multiple vb6 projects when there is no concept of solution like in later version of visual studio...)

I have been using Visual Studio 2010 but had to use 3rd party text editor to search in db scripts and vb6 source code.

I did some research and found KodeEx (http://kodeex.com) and have been happy withit. It is an index based source code search tool. You don't have to build anything (like other people suggested you do with Lucene. Lucene is a nice open source project by the way =) ). Just install it and let it index your projects. After that it usually returns result within a few seconds.

守不住的情 2024-07-12 22:14:57

请参阅我们的 SD 源代码搜索引擎。 语言感知并处理多种语言(C、C++、C#、Java、ObjectiveC、PHP、VB.net、VB6、Ada、Fortran、COBOL,...)。 在 Linux 内核中搜索需要 2.8 秒(730 万行,18000 多个文件)。

因为它具有语言感知能力,所以它可以忽略与您的搜索无关的语言元素(例如,如果您只对标识符或表达式感兴趣,则忽略注释、格式和空格)。 它可以搜索内部标识符、字符串和注释。 如果您确实想这样做,它有一个完整的正则表达式字符串搜索选项。

它已被用于具有数十百万行代码的系统,并且在我们所知的一种情况下,系统具有超过一百万个文件。

See our SD Source Code Search Engine. Language aware and handles many languages (C, C++, C#, Java, ObjectiveC, PHP, VB.net, VB6, Ada, Fortran, COBOL, ...). Takes 2.8 seconds to search across the Linux Kernal (7.3 million lines, 18000+ files).

Because it is language aware, it can ignore langauge elements irrelevant to your search (e.g., ignore comments, formatting and whitespace if you are only interested in an identifier or an expression). It can search inside identifiers, strings and comments. It has a full regular-expression string search option if you really want to do that.

It has been used for systems of 10s of millions of lines of code, and in one case we know about, a system with over a million files.

燃情 2024-07-12 22:14:57

也许您应该在支持符号标记的编辑器或 IDE 上投入一些时间和/或金钱。 您只需遍历整个源代码树即可对其进行标记,然后编辑器将使用索引搜索或映射查找来查找符号定义或引用。

支持标记的编辑器或 IDE 的一些示例包括 Eclipse、Visual Studio、SlickEdit。 某些 IDE 可能将该功能称为“符号浏览器”或类似名称。

Perhaps you should invest some time and/or money in an editor or IDE that supports symbol tagging. You only need to make one pass through the entire source tree to tag it, and thereafter the editor uses an index search or map lookup to find the symbol definition or references.

Some examples of editors or IDEs that support tagging are Eclipse, Visual Studio, SlickEdit. Some IDEs might call the feature Symbol Browser or something similar.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文