本文整理汇总了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)
示例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()
示例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)
示例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')))
示例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')))
示例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)
示例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()