def create_jp_location_fields(**kwargs):
    """
    Creates fields(romanized jp location data) for full text search.
    It should be called in create_document method.
    """
    fields = []
    for field in kwargs:
        if (re.match(ur'([\u3400-\u9fff])', kwargs[field])):
            romanized_japanese_location = (
                script_variant.romanize_japanese_location(kwargs[field]))
            if romanized_japanese_location:
                fields.append(
                    appengine_search.TextField(
                        name=field+'_romanized_by_jp_location_dict',
                        value=romanized_japanese_location)
                )
Example #2
0
 def test_romanize_japanese_location(self):
     assert script_variant.romanize_japanese_location(u'中野') == [u'NAKANO']
     assert script_variant.romanize_japanese_location(u'海门') == [u'海门']
     assert script_variant.romanize_japanese_location(u'') == [u'']
 def test_romanize_japanese_location(self):
     assert script_variant.romanize_japanese_location(u'中野') == [u'NAKANO']
     assert script_variant.romanize_japanese_location(u'海门') == [u'海门']
     assert script_variant.romanize_japanese_location(u'') == [u'']