当前位置: 首页>>代码示例>>Python>>正文


Python ComposedQuery.validate方法代码示例

本文整理汇总了Python中meresco.lucene.composedquery.ComposedQuery.validate方法的典型用法代码示例。如果您正苦于以下问题:Python ComposedQuery.validate方法的具体用法?Python ComposedQuery.validate怎么用?Python ComposedQuery.validate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在meresco.lucene.composedquery.ComposedQuery的用法示例。


在下文中一共展示了ComposedQuery.validate方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: testUniteMakesItTwoCoreQuery

# 需要导入模块: from meresco.lucene.composedquery import ComposedQuery [as 别名]
# 或者: from meresco.lucene.composedquery.ComposedQuery import validate [as 别名]
 def testUniteMakesItTwoCoreQuery(self):
     cq = ComposedQuery('coreA')
     cq.addMatch(dict(core='coreA', uniqueKey='keyA'), dict(core='coreB', key='keyB'))
     cq.setCoreQuery('coreA', query='A')
     cq.addUnite(dict(core='coreA', query='Q5'), dict(core='coreB', query='Q6'))
     cq.validate()
     self.assertEquals(set(['coreA', 'coreB']), cq.cores)
开发者ID:FashtimeDotCom,项目名称:meresco-lucene,代码行数:9,代码来源:composedquerytest.py

示例2: testUniqueKeyDoesntMatchResultsFrom

# 需要导入模块: from meresco.lucene.composedquery import ComposedQuery [as 别名]
# 或者: from meresco.lucene.composedquery.ComposedQuery import validate [as 别名]
 def testUniqueKeyDoesntMatchResultsFrom(self):
     composedQuery = ComposedQuery('coreA', query='A').setCoreQuery('coreB', query='bQ')
     self.assertRaises(ValueError, lambda: composedQuery.addMatch(dict(core='coreA', key='keyA'), dict(core='coreB', key='keyB')))
     self.assertRaises(ValueError, lambda: composedQuery.addMatch(dict(core='coreA', key='keyA'), dict(core='coreB', uniqueKey='keyB')))
     composedQuery.addMatch(dict(core='coreA', uniqueKey='keyA'), dict(core='coreB', key='keyB'))
     composedQuery.validate()
     composedQuery.addMatch(dict(core='coreA', uniqueKey='keyA'), dict(core='coreB', uniqueKey='keyB'))
     composedQuery.validate()
开发者ID:FashtimeDotCom,项目名称:meresco-lucene,代码行数:10,代码来源:composedquerytest.py

示例3: testValidateComposedQuery

# 需要导入模块: from meresco.lucene.composedquery import ComposedQuery [as 别名]
# 或者: from meresco.lucene.composedquery.ComposedQuery import validate [as 别名]
    def testValidateComposedQuery(self):
        composedQuery = ComposedQuery('coreA')
        composedQuery.setCoreQuery(core='coreA', query='Q0')
        composedQuery.setCoreQuery(core='coreB', query='Q1')
        self.assertValidateRaisesValueError(composedQuery, "No match set for cores ('coreA', 'coreB')")

        composedQuery = ComposedQuery('coreA', query="A")
        composedQuery.addMatch(dict(core='coreA', uniqueKey='keyA'), dict(core='coreB', key='keyB'))
        composedQuery.validate()
        self.assertEquals(1, composedQuery.numberOfUsedCores)
开发者ID:FashtimeDotCom,项目名称:meresco-lucene,代码行数:12,代码来源:composedquerytest.py

示例4: testConvertComposedQuery

# 需要导入模块: from meresco.lucene.composedquery import ComposedQuery [as 别名]
# 或者: from meresco.lucene.composedquery.ComposedQuery import validate [as 别名]
 def testConvertComposedQuery(self):
     q = ComposedQuery('A')
     q.setCoreQuery(core='A', query=cqlToExpression('valueAQ'))
     q.setCoreQuery(core='B', query=cqlToExpression('valueBQ'))
     q.addMatch(dict(core='A', uniqueKey='keyA'), dict(core='B', key='keyB'))
     q.addUnite(dict(core='A', query=cqlToExpression('fieldUA exact valueUA')), dict(core='B', query=cqlToExpression('fieldUB exact valueUB')))
     q.validate()
     consume(self.dna.any.executeComposedQuery(query=q))
     self.assertEquals(['executeComposedQuery'], self.observer.calledMethodNames())
     self.assertEquals("{'type': 'TermQuery', 'term': {'field': 'fieldA', 'value': u'valueaq'}, 'boost': 1.0}", repr(q.queryFor('A')))
     self.assertEquals("{'type': 'TermQuery', 'term': {'field': 'fieldB', 'value': u'valuebq'}, 'boost': 1.0}", repr(q.queryFor('B')))
开发者ID:FashtimeDotCom,项目名称:meresco-lucene,代码行数:13,代码来源:adaptertolucenequerytest.py

示例5: testConvertComposedQuery

# 需要导入模块: from meresco.lucene.composedquery import ComposedQuery [as 别名]
# 或者: from meresco.lucene.composedquery.ComposedQuery import validate [as 别名]
 def testConvertComposedQuery(self):
     q = ComposedQuery('A')
     q.setCoreQuery(core='A', query=parseString('valueAQ'))
     q.setCoreQuery(core='B', query=parseString('valueBQ'))
     q.addMatch(dict(core='A', uniqueKey='keyA'), dict(core='B', key='keyB'))
     q.addUnite(dict(core='A', query=parseString('fieldUA exact valueUA')), dict(core='B', query=parseString('fieldUB exact valueUB')))
     q.validate()
     consume(self.dna.any.executeComposedQuery(query=q))
     self.assertEquals(['executeComposedQuery'], self.observer.calledMethodNames())
     self.assertEquals(repr(TermQuery(Term('fieldA', 'valueaq'))), repr(q.queryFor('A')))
     self.assertEquals(repr(TermQuery(Term('fieldB', 'valuebq'))), repr(q.queryFor('B')))
开发者ID:jerryba,项目名称:meresco-lucene,代码行数:13,代码来源:multicqltolucenequerytest.py

示例6: testSingleCoreQuery

# 需要导入模块: from meresco.lucene.composedquery import ComposedQuery [as 别名]
# 或者: from meresco.lucene.composedquery.ComposedQuery import validate [as 别名]
 def testSingleCoreQuery(self):
     cq = ComposedQuery('coreA')
     cq.setCoreQuery(core='coreA', query='Q0')
     cq.validate()
     self.assertEquals(1, cq.numberOfUsedCores)
开发者ID:FashtimeDotCom,项目名称:meresco-lucene,代码行数:7,代码来源:composedquerytest.py

示例7: testValidateComposedQueryForInvalidJson

# 需要导入模块: from meresco.lucene.composedquery import ComposedQuery [as 别名]
# 或者: from meresco.lucene.composedquery.ComposedQuery import validate [as 别名]
 def testValidateComposedQueryForInvalidJson(self):
     composedQuery = ComposedQuery('coreA', query='Q0')
     composedQuery.relationalFilterJson = 'not JSON'
     self.assertValidateRaisesValueError(composedQuery, "Value 'not JSON' for 'relationalFilterJson' can not be parsed as JSON.")
     composedQuery.relationalFilterJson = '{"type": "MockJoinQuery"}'
     composedQuery.validate()
开发者ID:seecr,项目名称:meresco-lucene,代码行数:8,代码来源:composedquerytest.py


注:本文中的meresco.lucene.composedquery.ComposedQuery.validate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。