本文整理汇总了Python中wagtail.search.index.FilterField方法的典型用法代码示例。如果您正苦于以下问题:Python index.FilterField方法的具体用法?Python index.FilterField怎么用?Python index.FilterField使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wagtail.search.index
的用法示例。
在下文中一共展示了index.FilterField方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_basic
# 需要导入模块: from wagtail.search import index [as 别名]
# 或者: from wagtail.search.index import FilterField [as 别名]
def test_basic(self):
cls = self.make_dummy_type([
index.SearchField('test', boost=100, partial_match=False),
index.FilterField('filter_test'),
])
self.assertEqual(len(cls.get_search_fields()), 2)
self.assertEqual(len(cls.get_searchable_search_fields()), 1)
self.assertEqual(len(cls.get_filterable_search_fields()), 1)
示例2: test_different_field_types_dont_override
# 需要导入模块: from wagtail.search import index [as 别名]
# 或者: from wagtail.search.index import FilterField [as 别名]
def test_different_field_types_dont_override(self):
# A search and filter field with the same name should be able to coexist
cls = self.make_dummy_type([
index.SearchField('test', boost=100, partial_match=False),
index.FilterField('test'),
])
self.assertEqual(len(cls.get_search_fields()), 2)
self.assertEqual(len(cls.get_searchable_search_fields()), 1)
self.assertEqual(len(cls.get_filterable_search_fields()), 1)