搜索自定义节点' Drupal 中按字段?

发布于 2024-09-01 08:28:34 字数 211 浏览 3 评论 0原文

在一个项目中使用 Drupal,我使用 CCK 制作了自定义节点类型。我希望能够根据节点具有的自定义字段搜索特定节点。假设我有一个节点类型 Article,它有一个字段“myfield”,我希望能够根据 myfield 字段搜索文章。我了解默认搜索模块允许在搜索中使用 type:MyNodeType 搜索节点类型,但我没有看到任何方法来限制搜索哪些字段。有什么建议吗?这是要变得疯狂的事情吗?感谢您的帮助。

Using Drupal on a project which I made custom node types in using the CCK. I want to be able to search the specific node based on a custom field the node has. So let's say I have this node type Article which has a field "myfield", I want to be able to search for Articles based on the myfield field. I understand the default search module allows for searching of node types using the type:MyNodeType in the search, but I did not see any way to limit which fields are searched. Any tips? Is this something that is going to get crazy? Appreciate the help.

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

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

发布评论

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

评论(3

凉宸 2024-09-08 08:28:34

默认搜索无法按特定字段进行过滤。

你有几个选择。

  • 编写自定义代码来再次过滤数据库中的实际字段。
  • 使用视图模块,它可以让您根据特定字段进行过滤。
  • 安装 ApacheSolr 搜索引擎,它可以针对特定字段进行过滤。
    • 安装起来相当复杂。
    • 不过,如果您愿意安装它,那么它是比其他两个选项更好、更灵活的搜索。

The default search cannot filter by specific fields.

You have a couple options.

  • Write custom code that filters again the actual fields in the database.
  • Use the Views module, which lets you filter against specific fields.
  • Install the ApacheSolr search engine, which can filter against specific fields.
    • This is a fairly complex thing to install.
    • If you're comfortable installing it, though, it's a better and more flexible search than the other two options.
情场扛把子 2024-09-08 08:28:34

查看 CCK Facets 模块。有关此模块的更多详细信息(来自其项目页面):

CCK Facets 是一组模块,与分面搜索集成以公开内容构建工具包 (CCK) 字段作为构面。这允许用户浏览字段值并使用这些值过滤搜索结果。

支持的 CCK 字段类型有:

  • 文字
  • 数量
  • 节点参考
  • 用户参考
  • 日期
  • 日期戳

Checkout the CCK Facets module. Some more details about this module (from its project page):

CCK Facets is a bundle of modules that integrate with Faceted Search to expose Content Construction Kit (CCK) fields as facets. This allows users to browse field values and to filter search results with those values.

The supported CCK field types are:

  • Text
  • Number
  • Node Reference
  • User Reference
  • Date
  • Datestamp
り繁华旳梦境 2024-09-08 08:28:34

为此,我使用搜索 API 和搜索 API DB 模块以及视图。

这是一篇很好的如何文章

I use the Search API and Search API DB modules along wth Views for this.

This is a nice how to article.

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