Python wagtail.search.index.FilterField() Examples

The following are 2 code examples of wagtail.search.index.FilterField(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module wagtail.search.index , or try the search function .
Example #1
Source File: test_indexed_class.py    From wagtail with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
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) 
Example #2
Source File: test_indexed_class.py    From wagtail with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
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)