本文整理汇总了Python中Products.ZCTextIndex.ZCTextIndex.ZCTextIndex.clear方法的典型用法代码示例。如果您正苦于以下问题:Python ZCTextIndex.clear方法的具体用法?Python ZCTextIndex.clear怎么用?Python ZCTextIndex.clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Products.ZCTextIndex.ZCTextIndex.ZCTextIndex
的用法示例。
在下文中一共展示了ZCTextIndex.clear方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_ZCTextIndex
# 需要导入模块: from Products.ZCTextIndex.ZCTextIndex import ZCTextIndex [as 别名]
# 或者: from Products.ZCTextIndex.ZCTextIndex.ZCTextIndex import clear [as 别名]
def test_ZCTextIndex(self):
from xml.dom.minidom import parseString
from Products.ZCTextIndex.ZCTextIndex import PLexicon
from Products.ZCTextIndex.ZCTextIndex import ZCTextIndex
from Products.GenericSetup.testing import DummySetupEnviron
from Products.GenericSetup.ZCTextIndex.exportimport \
import ZCTextIndexNodeAdapter
_XML = """\
<index name="foo_zctext" meta_type="ZCTextIndex">
<indexed_attr value="bar"/>
<extra name="index_type" value="Okapi BM25 Rank"/>
<extra name="lexicon_id" value="foo_plexicon"/>
</index>
"""
environ = DummySetupEnviron()
def _no_clear(*a):
raise AssertionError("Don't clear me!")
catalog = DummyCatalog()
catalog.foo_plexicon = PLexicon('foo_plexicon')
extra = _extra()
extra.lexicon_id = 'foo_plexicon'
extra.index_type='Okapi BM25 Rank'
index = ZCTextIndex('foo_field', extra=extra, field_name='bar',
caller=catalog).__of__(catalog)
index.clear = _no_clear
adapted = ZCTextIndexNodeAdapter(index, environ)
adapted.node = parseString(_XML).documentElement # no raise