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


Python ComposedQuery.setRankQuery方法代码示例

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


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

示例1: XXX_NOT_YET_IMPLEMENTED_testRankQueryInSingleCoreQuery

# 需要导入模块: from meresco.lucene.composedquery import ComposedQuery [as 别名]
# 或者: from meresco.lucene.composedquery.ComposedQuery import setRankQuery [as 别名]
 def XXX_NOT_YET_IMPLEMENTED_testRankQueryInSingleCoreQuery(self):
     q = ComposedQuery('coreA', query=MatchAllDocsQuery())
     q.addMatch(dict(core='coreA', uniqueKey=KEY_PREFIX+'A'), dict(core='coreB', key=KEY_PREFIX+'B'))
     q.setRankQuery(core='coreA', query=luceneQueryFromCql('Q=true'))
     result = returnValueFromGenerator(self.dna.any.executeComposedQuery(q))
     self.assertEquals(8, result.total)
     self.assertEquals([u'A-Q', u'A-QU', u'A-MQ', u'A-MQU', u'A', u'A-U', u'A-M', u'A-MU'], [hit.id for hit in result.hits])
开发者ID:jerryba,项目名称:meresco-lucene,代码行数:9,代码来源:multilucenetest.py

示例2: testAddRankQuery

# 需要导入模块: from meresco.lucene.composedquery import ComposedQuery [as 别名]
# 或者: from meresco.lucene.composedquery.ComposedQuery import setRankQuery [as 别名]
 def testAddRankQuery(self):
     cq = ComposedQuery('coreA')
     cq.setRankQuery('coreB', 'qB')
     self.assertValidateRaisesValueError(cq, "No match set for cores ('coreA', 'coreB')")
     cq.addMatch(dict(core='coreA', uniqueKey='kA'), dict(core='coreB', key='kB'))
     self.assertEquals('qB', cq.rankQueryFor('coreB'))
     cq.convertWith(coreB=lambda q: "converted_" + q)
     self.assertEquals('converted_qB', cq.rankQueryFor('coreB'))
开发者ID:FashtimeDotCom,项目名称:meresco-lucene,代码行数:10,代码来源:composedquerytest.py

示例3: testRankQuery

# 需要导入模块: from meresco.lucene.composedquery import ComposedQuery [as 别名]
# 或者: from meresco.lucene.composedquery.ComposedQuery import setRankQuery [as 别名]
 def testRankQuery(self):
     q = ComposedQuery('coreA', query=MatchAllDocsQuery())
     q.setCoreQuery(core='coreB', query=luceneQueryFromCql('N=true'))
     q.setRankQuery(core='coreC', query=luceneQueryFromCql('S=true'))
     q.addMatch(dict(core='coreA', uniqueKey=KEY_PREFIX+'A'), dict(core='coreB', key=KEY_PREFIX+'B'))
     q.addMatch(dict(core='coreA', uniqueKey=KEY_PREFIX+'A'), dict(core='coreC', key=KEY_PREFIX+'C'))
     result = returnValueFromGenerator(self.dna.any.executeComposedQuery(q))
     self.assertEquals(4, result.total)
     self.assertEquals([u'A-MQU', 'A-M', 'A-MU', u'A-MQ'], [hit.id for hit in result.hits])
开发者ID:jerryba,项目名称:meresco-lucene,代码行数:11,代码来源:multilucenetest.py

示例4: testScoreCollectorCacheInvalidation

# 需要导入模块: from meresco.lucene.composedquery import ComposedQuery [as 别名]
# 或者: from meresco.lucene.composedquery.ComposedQuery import setRankQuery [as 别名]
    def testScoreCollectorCacheInvalidation(self):
        q = ComposedQuery('coreA', query=MatchAllDocsQuery())
        q.setRankQuery(core='coreC', query=luceneQueryFromCql('S=true'))
        q.addMatch(dict(core='coreA', uniqueKey=KEY_PREFIX+'A'), dict(core='coreC', key=KEY_PREFIX+'C'))
        result = returnValueFromGenerator(self.dna.any.executeComposedQuery(q))
        self.assertEquals(8, result.total)
        self.assertEquals(u'A-MQU', result.hits[0].id)
        self.assertEquals(set([u'A', u'A-U', u'A-Q', u'A-QU', u'A-M', u'A-MU', u'A-MQ']), set([hit.id for hit in result.hits[1:]]))

        self.addDocument(self.luceneC, identifier='C-S>A-MQ', keys=[('C', 7)], fields=[('S', 'true')])
        try:
            result = returnValueFromGenerator(self.dna.any.executeComposedQuery(q))
            self.assertEquals(8, result.total)
            self.assertEquals(set([u'A-MQ' , u'A-MQU']), set([hit.id for hit in result.hits[:2]]))
            self.assertEquals(set([u'A', u'A-U', u'A-Q', u'A-QU', u'A-M', u'A-MU']), set([hit.id for hit in result.hits[2:]]))
        finally:
            self.luceneC.delete(identifier='C-S>A-MQ')
开发者ID:jerryba,项目名称:meresco-lucene,代码行数:19,代码来源:multilucenetest.py


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