Skip to content

Orchard provides the ability to index and search content items in the application. The indexing functionality is provided by enabling the Indexing feature, along with a specific implementation of indexing (Lucene-based is included by default). In addition to the Indexing, the Search feature provides the ability to query the index (by keyword or using Lucene query syntax) to return a list of content items matching the query on the front end.

Orchard提供了在应用程序中索引和搜索内容项的功能。通过启用 Indexing 功能以及索引的特定实现(默认情况下包含基于Lucene)来提供索引功能。除了索引之外,搜索功能还提供了查询索引(通过关键字或使用Lucene查询语法)以返回与前端查询匹配的内容项列表的功能。

You must enable all the following Modules Search, Indexing, and Lucene.

您必须启用以下所有模块搜索索引 Lucene

Because search depends on indexing, enabling search will automatically enable indexing as well. Note that you must also enable Lucene before search and indexing will work.

由于搜索依赖于索引,因此启用搜索也会自动启用索引。请注意,在搜索和索引编制工作之前,您还必须启用Lucene。

When the indexing feature is enabled, a new Search and Indexes item becomes available under the Settings section of the dashboard. The indexer runs as a background task, once per minute by default, and you can optionally update or rebuild the index from this screen. The Indexes screen also displays the number of documents (content items) indexed and the Search screen displays the indexed fields.

启用索引功能后,仪表板的设置部分下将显示新的搜索索引项。索引器作为后台任务运行,默认情况下每分钟运行一次,您可以选择从此屏幕更新或重建索引。 索引屏幕还显示索引的文档(内容项)数量,搜索屏幕显示索引字段。

After enabling the Search feature goto the Content Definition section and click on any Content Type which you want to index and then check the check box for the available index. For e.g. Page Content Type

启用 Search 功能后,转到内容定义部分,然后单击要索引的任何内容类型,然后选中可用索引的复选框。对于例如页面内容类型

When the search feature is enabled, the Settings screen in the dashboard displays the fields that will be queried from the index (listed on the Search screen).

启用搜索功能后,仪表板中的设置屏幕将显示将从索引中查询的字段(在“搜索”屏幕上列出)。

The front end of the site does not have the searching UI yet at this point. To add it, you need to add a widget. Click Widgets in the admin menu. With the default layer selected, click Add to zone next to SearchForm in the list of available widgets.

此时站点的前端还没有搜索UI。要添加它,您需要添加一个小部件。单击管理菜单中的小部件。选中默认图层后,单击可用窗口小部件列表中 SearchForm 旁边的添加到区域

Keep "Header" selected as the zone and "Default" as the layer so that your search widget appears on top of all pages (the default layer applies to all pages in the site).

选中“标题”作为区域,选择“默认”作为图层,以便您的搜索小部件显示在所有页面的顶部(默认图层适用于网站中的所有页面)。

Give it a title such as "Search" and click the Save button.

给它一个标题,如“搜索”,然后单击保存按钮。

For more information about widgets, see Managing widgets.

有关窗口小部件的更多信息,请参阅[管理窗口小部件](管理窗口小部件)。

If you navigate now to any page in the front end of the site, you will see the search form.

如果您现在导航到站点前端的任何页面,您将看到搜索表单。

When you type a keyword or query into this input box, a list of matching content items is displayed.

在此输入框中键入关键字或查询时,将显示匹配的内容项列表。

Change History

改变历史

  • Updates for Orchard 1.8

  • Orchard 1.8的更新 *

    • 9-05-14: Updated all screen shots for Search , Indexing and Lucene