创建可编程搜索引擎
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
您可以通过以下两种方式创建可编程搜索引擎:
要开始使用可编程搜索引擎,最简单的方法就是使用控制面板创建一个基本搜索引擎。然后,您可以下载引擎的 XML 文件并进行修改,以添加更多自定义内容。
由于您正在试验和弄清楚一些基本概念,因此只需花几分钟时间即可构建您的第一个搜索引擎。请确保测试项目简单明了,以便您在开始测试时了解测试进展。并且以后可以随时做出更改。
在控制台中定义可编程搜索引擎
如需创建可编程搜索引擎,请按以下步骤操作:
- 使用 Google 账号登录控制台(如果你没有账号,请获取账号)。
- 在为您的搜索引擎命名部分,指定您的搜索引擎的名称。您可以随时更改此名称。
- 在要搜索的内容部分中,添加要包含在搜索引擎中的网页。您可以添加任何所需的网站,而不仅仅是您拥有的网站。您可以添加整个网站网址或单个网页的网址,也可以使用网址格式。
- 点击创建。
您可以使用自己的基本搜索引擎了!要查看更多配置选项,请转到控制台。
如需详细了解控制台中提供的选项,请访问可编程搜索引擎帮助中心。要添加高级选项(例如过滤或结果顺序),并通过 XML 配置文件进一步自定义您的搜索引擎,请参阅开发者指南。
使用引擎
定义搜索引擎后,可通过以下两种方式访问它:
- Google 托管的可编程搜索引擎首页 - 您可以在概览页面的基本部分找到您的引擎首页的公开网址,并将其分享给您的用户。
- 网站中的搜索框 - 如果您在网页中嵌入搜索框,则用户可以在您的网站中执行搜索。
下一个...
继续阅读实现搜索框。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-25。
[null,null,["最后更新时间 (UTC):2025-07-25。"],[[["\u003cp\u003eProgrammable Search Engines can be created through a user-friendly Control Panel or by defining them within an XML file.\u003c/p\u003e\n"],["\u003cp\u003eThe Control Panel offers a simple way to build a basic search engine, allowing you to specify the name, website scope, and included pages.\u003c/p\u003e\n"],["\u003cp\u003eAfter creation, your search engine is accessible via a public URL or by embedding a search box directly into your website.\u003c/p\u003e\n"],["\u003cp\u003eFurther customization, such as filtering and result ordering, can be achieved by modifying the engine's XML configuration files.\u003c/p\u003e\n"]]],[],null,["# Creating a Programmable Search Engine\n\nThere are two ways of creating a Programmable Search Engine:\n\n- using the [Control Panel](https://programmablesearchengine.google.com/controlpanel/create)\n- creating an [XML file](/custom-search/docs/basics) with the definition of the engine\n\nThe easiest way to get started with Programmable Search Engine is to create a basic search engine using the [Control Panel](https://programmablesearchengine.google.com/controlpanel/create). You can then download the engine's XML files and modify them to add further customizations.\nSince you're experimenting and figuring out some basic concepts, spend only a couple of minutes making your first search engine. Keep it simple so that you can follow what's happening when you start testing it. You can always change it later.\n\nDefining a Programmable Search Engine in Control Panel\n------------------------------------------------------\n\nTo create a Programmable Search Engine:\n\n1. Sign into [Control Panel](https://programmablesearchengine.google.com/controlpanel/create) using your Google Account ([get an account](https://www.google.com/accounts/NewAccount) if you don't have one).\n2. In the **Name your search engine** section, specify your search engine's name. You can change this name at any time.\n3. In the **What to search?** section, add the pages you want to include in your search engine. You can include any sites you want, not just the sites you own. You can include whole site URLs or individual pages URLs. You can also use [URL patterns](https://support.google.com/programmable-search/answer/12397162).\n4. Click **Create**.\n\nYour basic search engine is ready to use! To see more configuration options, go to the [Control Panel](https://programmablesearchengine.google.com/controlpanel/all).\n\nTo learn more about options available in Control Panel, visit the [Programmable Search Engine Help Center](http://support.google.com/programmable-search/). To add advanced options (e.g. filtering or results order) and further customize your search engine via XML configuration files, see the [Developer Guide](/custom-search/docs/basics#steps).\n\nUsing the engine\n----------------\n\nOnce you have defined your search engine, it can be accessed in two ways:\n\n- Google-hosted Programmable Search Engine homepage - you can find the **Public URL** for your engine homepage in the **Overview** page's **Basic** section and share it with your users.\n- A search box in your website - If you embed a search box in your webpage, your users can make searches from your website.\n\nNext...\n-------\n\nContinue to [Implementing search box](/custom-search/docs/tutorial/implementingsearchbox)."]]