搜索项目或文件 (AEN 4.1.3)#

要搜索项目和文件,请使用AEN导航栏中的搜索框。根据您从哪个页面进行搜索,搜索结果会有所不同:

  • On a project home page, search results include any files that match your search criteria within the current project.
  • On any other AEN page, search results include any files that match your search criteria within all projects.

提示:您的搜索结果仅包括您可以查看的文件和项目:公共项目,以及您至少具有查看权限的私有项目。

搜索的文件类型

搜索结果中包含以下类型的文件:

  • .py—Python source files.
  • .ipynb—IPython/Jupyter notebooks.
  • .txt—plain text files.
  • .md—Markdown files.

搜索索引

在项目运行时被修改的文件会在文件修改后不久自动重新索引。如果您创建或更新了大量文件——例如克隆一个git仓库或复制一个目录——搜索结果可能需要几分钟才能更新。

在项目未运行时修改的文件仅在项目启动后重新索引。

使用搜索构造

您可以使用以下搜索结构:

  • 普通词语将匹配任何文件的全文内容。

  • 允许使用通配符。

    示例:John* 将匹配 John 和 Johnny。这些是 全局模式,类似于在命令行中的使用。

  • 使用ANDOR组合查询,并使用括号()对它们进行分组。

正则表达式模式可以通过用正斜杠(/)包裹的方式嵌入到查询字符串中:

name:/joh?n(ath[oa]n)/

支持的正则表达式语法在 Elasticsearch 参考文档中有详细解释。

注意:通配符适用于正则表达式内部。查询字符串如 /.*n/ 将强制搜索访问索引中的每个术语。

搜索元数据字段

您可以在特定的元数据字段中搜索:

  • imports:name—matches files that import the module name.
  • uses:name—matches files that reference the identifier name. Referenced names include any functions and globals imported from other modules, as well as the names of any methods invoked on any object.
  • defines:name—matches files that define the identifier name. Defined names include functions defined at global scope, class names, and method names within classes.
  • acl:user—matches files in which the named user has read access or higher.

搜索项目

  1. 在搜索框中,输入一串文本:

    ../../../../../_images/ae-notebooks/4.1.3/aen-user-search_box.png

    提示:通过glob模式进行搜索,这类似于命令行中的文件匹配。

    示例:要查找编号从00到99的测试系列项目,请搜索Test-??。要查找名称以“Stats”结尾的所有项目,请搜索*Stats

  2. 按下回车键。

  3. 在搜索结果中,点击项目名称上方的加号 + 图标,以显示所选项目中的匹配文件列表:

    ../../../../../_images/ae-notebooks/4.1.3/aen-user-search_results_expansion_icon.png

    提示:点击项目名称以打开项目的主页。

  4. 要查看文件,请在匹配文件列表中点击其文件名:

    ../../../../../_images/ae-notebooks/4.1.3/aen-user-search_results_details.png