示例#1
0
 def test_field_analyzer(self):
     """Ensure that field analyzer works on a case by case basis"""
     back_class = backends.ConfigurableElasticBackend('default', URL="",
             INDEX_NAME="")
     # Control test - by default the CharField does not have a keyword
     # argument named 'analyzer' and does not take **kwargs
     self.assertRaises(TypeError, HaystackCharField, document=True,
                       use_template=True, index_fieldname='body', analyzer='stop')
     text_field = fields.CharField(document=True, use_template=True,
             index_fieldname='body', analyzer='stop')
     schema = back_class.build_schema({'body': text_field})
     self.assertEqual("stop", schema[1]['body']['analyzer'])
示例#2
0
 def test_field_analyzer(self):
     """Ensure that field analyzer works on a case by case basis"""
     back_class = backends.ConfigurableElasticBackend(
         "default", URL="http://localhost:9200", INDEX_NAME="")
     # Control test - by default the CharField does not have a keyword
     # argument named 'analyzer' and does not take **kwargs
     self.assertRaises(
         TypeError,
         HaystackCharField,
         document=True,
         use_template=True,
         index_fieldname="body",
         analyzer="stop",
     )
     text_field = fields.CharField(document=True,
                                   use_template=True,
                                   index_fieldname="body",
                                   analyzer="stop")
     schema = back_class.build_schema({"body": text_field})
     self.assertEqual("stop", schema[1]["body"]["analyzer"])