【问题标题】:How to determine particular page types for a wagtail default search?如何确定鹡鸰默认搜索的特定页面类型?
【发布时间】:2021-01-19 02:16:26
【问题描述】:

默认情况下包含的常规 wagtail 搜索会搜索项目的所有页面。如何确定搜索索引的特定页面?

【问题讨论】:

    标签: python django search wagtail


    【解决方案1】:

    搜索时,您可以通过任何queryset methods 过滤页面查询集,然后在其上运行search。所以,比如搜索blog页面下的所有页面:

    blog_index = Page.objects.get(slug='blog')
    results = Page.objects.descendant_of(blog_index).search("my query")
    

    【讨论】:

    • 但是如果我只需要查询 2 种以上没有父页面或子页面的页面类型,我应该如何构建查询?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-08-23
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多