自定义搜索引擎_如何创建自己的自定义Google搜索引擎

2022-09-14 10:17:24 浏览数 (1)

大家好,又见面了,我是你们的朋友全栈君。

自定义搜索引擎

Have you ever wanted to create a custom Google search engine that searches only specific websites? You can easily do this with Google’s Custom Search Engine tool. You can bookmark your search engine and even share it with other people.

您是否曾经想过创建仅搜索特定网站的自定义Google搜索引擎? 您可以使用Google的“自定义搜索引擎”工具轻松完成此操作。 您可以为搜索引擎添加书签,甚至可以与他人共享。

This trick works similarly to Google’s site: operator, but you won’t have to type the operator every time you search. It’s particularly useful if you want to search a large number of sites at once.

此技巧的用法类似于Google的站点:operator ,但是您不必在每次搜索时都键入运算符。 如果要一次搜索大量站点,此功能特别有用。

创建自定义搜索引擎 (Creating a Custom Search Engine)

To get started, head over to the Google Custom Search Engine page and click the Create a custom search engine button. You’ll need a Google account for this – the search engine will be saved with your Google account.

首先,请转到Google自定义搜索引擎页面,然后单击创建自定义搜索引擎按钮。 为此,您需要一个Google帐户-搜索引擎将与您的Google帐户一起保存。

Enter a name and description for your search engine – these can be anything you like.

输入搜索引擎的名称和描述-您可以随意输入。

The Sites to search field is the one that really matters. Here, you’ll specify a list of the websites you want to search. For example, if you wanted to search both howtogeek.com and microsoft.com, you’d enter:

要搜索网站”字段确实很重要。 在这里,您将指定要搜索的网站列表。 例如,如果您要搜索howtogeek.com和microsoft.com,请输入:

howtogeek.com/* howtogeek.com/* microsoft.com/* microsoft.com/*

The * character is the wildcard, which can match anything, so the /* characters tell your search engine to search everything on both of these websites.

*字符是通配符,可以匹配任何内容,因此/ *字符告诉您的搜索引擎搜索这两个网站上的所有内容。

There are more advanced things you can do with this box – we’ll get back to that in a bit.

您可以使用此框执行更高级的操作-我们稍后再讨论。

After clicking Next, you can specify a style for your search results and test the search engine you created.

单击“下一步”后,您可以为搜索结果指定样式并测试您创建的搜索引擎。

Once you’re happy with your search engine, click the Next button at the bottom of the page and you’ll end up at a page that gives you an embed code for your search engine.

对搜索引擎感到满意之后,请单击页面底部的“下一步”按钮,您将最终到达一个为您的搜索引擎提供嵌入代码的页面。

You’re probably not a web developer, so you’ll want to ignore this page. Click the Google Custom Search logo at the top of the page instead.

您可能不是网络开发人员,所以您将忽略此页面。 而是点击页面顶部的Google自定义搜索徽标。

To get to your search engine’s page, click its name in the list of search engines you’ve created.

要进入搜索引擎页面,请在您创建的搜索引擎列表中单击其名称。

You can bookmark this page for easy access your search engine. You can also share your search engine with anyone by sending them the full URL that appears in your address bar.

您可以在此页面上添加书签,以方便访问搜索引擎。 您还可以通过向他们发送地址栏中显示的完整URL,与任何人共享搜索引擎。

URL技巧 (URL Tricks)

You don’t have to specify an entire website while creating your custom search engine.

创建自定义搜索引擎时,您不必指定整个网站。

For example, the custom search engine above searches all areas of microsoft.com. If we do an example search, we might see that there’s useful information coming from windows.microsoft.com and support.microsoft.com, but the results from answers.microsoft.com (Microsoft’s support forum) are not very helpful.

例如,上面的自定义搜索引擎搜索microsoft.com的所有区域。 如果我们进行示例搜索,我们可能会发现有一些有用的信息来自windows.microsoft.comsupport.microsoft.com ,但是answers.microsoft.com (Microsoft的支持论坛)的结果不是很有帮助。

To exclude answers.microsoft.com and include the other subdomains, we could use the following URL list while creating a search engine:

为了排除Answers.microsoft.com并包括其他子域,我们可以在创建搜索引擎时使用以下URL列表:

howtogeek.com/* windows.microsoft.com/* support.microsoft.com/* howtogeek.com/* windows.microsoft.com/* support.microsoft.com/*

Note that there’s no way to exclude a specific subdomain – we can only include the ones we want to search. This list will search only the two subdomains on microsoft.com.

请注意,无法排除特定的子域-我们只能包含要搜索的子域。 此列表将仅搜索microsoft.com上的两个子域。

There are several other types of URLs you can define in this list:

您可以在此列表中定义其他几种URL:

  • Single Page: You can define only one specific page by entering its URL, such as example.com/page.html. This will include only a single web page in the search engine. 单页 :您只能通过输入URL来定义一个特定页面,例如example.com/page.html 。 这将仅在搜索引擎中包含一个网页。
  • Part of a Website: You can use the * character in other ways. For example, the URL support.microsoft.com/kb/* will search only Microsoft Knowledge Base articles. Using the URL example.com/*word* will search all pages on example.com that have word in their URLs. 网站的一部分 :您可以通过其他方式使用*字符。 例如,URL support.microsoft.com/kb/*将仅搜索Microsoft知识库文章。 使用URL example.com/*word*将搜索example.com上URL中包含单词的所有页面。

You can continue fine-tuning the search engine until you’re happy with the results by clicking the back to step 1 link, modifying the URLs, and then performing another test search.

您可以继续微调搜索引擎,直到对结果满意为止,方法是单击返回到步骤1的链接,修改URL,然后执行另一个测试搜索。

Once you’re done, you can even add your custom search engine to your browser’s search bar.

完成后,您甚至可以将自定义搜索引擎添加到浏览器的搜索栏中 。

翻译自: https://www.howtogeek.com/124703/how-to-create-your-own-custom-google-search-engine/

自定义搜索引擎

发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/158579.html原文链接:https://javaforall.cn

0 人点赞