本文整理汇总了Python中meresco.lucene.composedquery.ComposedQuery.addDrilldownQuery方法的典型用法代码示例。如果您正苦于以下问题:Python ComposedQuery.addDrilldownQuery方法的具体用法?Python ComposedQuery.addDrilldownQuery怎么用?Python ComposedQuery.addDrilldownQuery使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类meresco.lucene.composedquery.ComposedQuery
的用法示例。
在下文中一共展示了ComposedQuery.addDrilldownQuery方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testAddDrilldownQuery
# 需要导入模块: from meresco.lucene.composedquery import ComposedQuery [as 别名]
# 或者: from meresco.lucene.composedquery.ComposedQuery import addDrilldownQuery [as 别名]
def testAddDrilldownQuery(self):
cq = ComposedQuery('coreA')
cq.addDrilldownQuery('coreB', ('field', ['value']))
self.assertValidateRaisesValueError(cq, "No match set for cores ('coreA', 'coreB')")
cq.addMatch(dict(core='coreA', uniqueKey='kA'), dict(core='coreB', key='kB'))
self.assertEquals([('field', ['value'])], cq.drilldownQueriesFor('coreB'))
cq.convertWith(coreB=lambda q: "converted_" + q)
self.assertEquals([('field', ['value'])], cq.drilldownQueriesFor('coreB'))
示例2: testAddFilterQueryAfterConversion
# 需要导入模块: from meresco.lucene.composedquery import ComposedQuery [as 别名]
# 或者: from meresco.lucene.composedquery.ComposedQuery import addDrilldownQuery [as 别名]
def testAddFilterQueryAfterConversion(self):
cq = ComposedQuery('coreA')
cq.setCoreQuery('coreA', query='A')
cq.convertWith(coreA=lambda q: "converted_" + q)
self.assertEquals('converted_A', cq.queryFor('coreA'))
# Assert the following does not raise KeyError
cq.addFilterQuery('coreA', 'field=value')
cq.addFacet('coreA', 'F0')
cq.addDrilldownQuery('coreA', 'drilldownQuery')
cq.addOtherCoreFacetFilter('coreA', 'q')
示例3: testJoinFacetWithJoinDrilldownQueryFilters
# 需要导入模块: from meresco.lucene.composedquery import ComposedQuery [as 别名]
# 或者: from meresco.lucene.composedquery.ComposedQuery import addDrilldownQuery [as 别名]
def testJoinFacetWithJoinDrilldownQueryFilters(self):
q = ComposedQuery('coreA', query=luceneQueryFromCql('M=true'))
q.addDrilldownQuery('coreB', drilldownQuery=('cat_O', ['true']))
q.addFacet('coreB', dict(fieldname='cat_O', maxTerms=10))
q.addMatch(dict(core='coreA', uniqueKey=KEY_PREFIX + 'A'), dict(core='coreB', key=KEY_PREFIX + 'B'))
result = returnValueFromGenerator(self.dna.any.executeComposedQuery(query=q))
self.assertEquals(2, result.total)
self.assertEquals([{
'terms': [
{'count': 3, 'term': u'true'},
],
'path': [],
'fieldname': u'cat_O'
}], result.drilldownData)
示例4: testJoinDrilldownQueryFilters
# 需要导入模块: from meresco.lucene.composedquery import ComposedQuery [as 别名]
# 或者: from meresco.lucene.composedquery.ComposedQuery import addDrilldownQuery [as 别名]
def testJoinDrilldownQueryFilters(self):
q = ComposedQuery('coreA', query=luceneQueryFromCql('M=true'))
q.addDrilldownQuery('coreB', drilldownQuery=('cat_O', ['true']))
q.addMatch(dict(core='coreA', uniqueKey=KEY_PREFIX + 'A'), dict(core='coreB', key=KEY_PREFIX + 'B'))
result = returnValueFromGenerator(self.dna.any.executeComposedQuery(query=q))
self.assertEquals(2, result.total)