本文整理匯總了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)