本文整理汇总了Python中meresco.lucene.composedquery.ComposedQuery.facetsFor方法的典型用法代码示例。如果您正苦于以下问题:Python ComposedQuery.facetsFor方法的具体用法?Python ComposedQuery.facetsFor怎么用?Python ComposedQuery.facetsFor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类meresco.lucene.composedquery.ComposedQuery
的用法示例。
在下文中一共展示了ComposedQuery.facetsFor方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testFilterQueries
# 需要导入模块: from meresco.lucene.composedquery import ComposedQuery [as 别名]
# 或者: from meresco.lucene.composedquery.ComposedQuery import facetsFor [as 别名]
def testFilterQueries(self):
cq = ComposedQuery('coreA')
cq.setCoreQuery(core='coreA', query='Q0')
cq.addFilterQuery(core='coreA', query='Q1')
cq.addFilterQuery(core='coreA', query='Q2')
cq.addFacet(core='coreA', facet='F0')
cq.addFacet(core='coreA', facet='F1')
cq.setCoreQuery(core='coreB', query='Q3')
cq.addMatch(dict(core='coreA', uniqueKey='keyA'), dict(core='coreB', key='keyB'))
cq.addUnite(dict(core='coreA', query='AQuery'), dict(core='coreB', query='anotherQuery'))
self.assertEquals(None, cq.stop)
self.assertEquals(None, cq.start)
self.assertEquals([], cq.sortKeys)
cq.stop = 10
cq.start = 0
cq.sortKeys = [dict(sortBy='field', sortDescending=True)]
self.assertEquals('Q0', cq.queryFor('coreA'))
self.assertEquals(['Q1', 'Q2'], cq.filterQueriesFor('coreA'))
self.assertEquals(['F0', 'F1'], cq.facetsFor('coreA'))
self.assertEquals(10, cq.stop)
self.assertEquals(0, cq.start)
self.assertEquals([dict(sortBy='field', sortDescending=True)], cq.sortKeys)
示例2: testAddFacetIncremental
# 需要导入模块: from meresco.lucene.composedquery import ComposedQuery [as 别名]
# 或者: from meresco.lucene.composedquery.ComposedQuery import facetsFor [as 别名]
def testAddFacetIncremental(self):
cq = ComposedQuery('coreA')
cq.addFacet(core='coreA', facet=dict(fieldname='Q1', maxTerms=10))
cq.addFacet(core='coreA', facet=dict(fieldname='Q2', maxTerms=10))
self.assertEquals([dict(fieldname='Q1', maxTerms=10), dict(fieldname='Q2', maxTerms=10)], cq.facetsFor('coreA'))