本文整理汇总了Python中meresco.lucene.fieldregistry.FieldRegistry.defaultMissingValueForSort方法的典型用法代码示例。如果您正苦于以下问题:Python FieldRegistry.defaultMissingValueForSort方法的具体用法?Python FieldRegistry.defaultMissingValueForSort怎么用?Python FieldRegistry.defaultMissingValueForSort使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类meresco.lucene.fieldregistry.FieldRegistry
的用法示例。
在下文中一共展示了FieldRegistry.defaultMissingValueForSort方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testSortField
# 需要导入模块: from meresco.lucene.fieldregistry import FieldRegistry [as 别名]
# 或者: from meresco.lucene.fieldregistry.FieldRegistry import defaultMissingValueForSort [as 别名]
def testSortField(self):
registry = FieldRegistry()
registry.register("sorted.longfield", fieldDefinition=LONGFIELD)
registry.register("sorted.intfield", fieldDefinition=INTFIELD)
registry.register("sorted.stringfield", fieldDefinition=STRINGFIELD)
self.assertEqual("Long", registry.sortFieldType("sorted.longfield"))
self.assertEqual(None, registry.defaultMissingValueForSort("sorted.longfield", True))
self.assertEqual("Int", registry.sortFieldType("sorted.intfield"))
self.assertEqual(None, registry.defaultMissingValueForSort("sorted.intfield", True))
self.assertEqual("String", registry.sortFieldType("sorted.stringfield"))
self.assertEqual("STRING_FIRST", registry.defaultMissingValueForSort("sorted.stringfield", True))
self.assertEqual("STRING_LAST", registry.defaultMissingValueForSort("sorted.stringfield", False))
self.assertEqual(None, registry.defaultMissingValueForSort("score", False))
field = registry.createField('sorted.longfield', 'id:1')
self.assertEqual({'name': 'sorted.longfield', 'type': 'LongField', 'value': 'id:1', 'sort': True}, field)