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


Python ComposedQuery.filterQueriesFor方法代码示例

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


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

示例1: testConvertAllQueries

# 需要导入模块: from meresco.lucene.composedquery import ComposedQuery [as 别名]
# 或者: from meresco.lucene.composedquery.ComposedQuery import filterQueriesFor [as 别名]
    def testConvertAllQueries(self):
        cq = ComposedQuery('coreA')
        cq.setCoreQuery(core='coreA', query='Q0')
        cq.addFilterQuery('coreA', 'Q1')
        cq.addFilterQuery('coreA', 'Q2')
        cq.setCoreQuery(core='coreB', query='Q3')
        cq.addFilterQuery('coreB', 'Q4')
        cq.addMatch(dict(core='coreA', uniqueKey='keyA'), dict(core='coreB', key='keyB'))
        cq.addUnite(dict(core='coreA', query='Q5'), dict(core='coreB', query='Q6'))
        convertCoreA = lambda query: "Converted_A_{0}".format(query)
        convertCoreB = lambda query: "Converted_B_{0}".format(query)
        cq.convertWith(coreA=convertCoreA, coreB=convertCoreB)

        self.assertEquals("Converted_A_Q0", cq.queryFor('coreA'))
        self.assertEquals(["Converted_A_Q1", "Converted_A_Q2"], cq.filterQueriesFor('coreA'))
        self.assertEquals("Converted_B_Q3", cq.queryFor('coreB'))
        self.assertEquals(["Converted_B_Q4"], cq.filterQueriesFor('coreB'))
        self.assertEquals([('coreA', 'Converted_A_Q5'), ('coreB', 'Converted_B_Q6')], cq.unites)
开发者ID:jerryba,项目名称:meresco-lucene,代码行数:20,代码来源:composedquerytest.py

示例2: testConvertAllQueriesWithUnqualifiedTermFields

# 需要导入模块: from meresco.lucene.composedquery import ComposedQuery [as 别名]
# 或者: from meresco.lucene.composedquery.ComposedQuery import filterQueriesFor [as 别名]
    def testConvertAllQueriesWithUnqualifiedTermFields(self):
        cq = ComposedQuery('coreA')
        cq.setCoreQuery(core='coreA', query='Q0')
        cq.addFilterQuery('coreA', 'Q1')
        cq.addFilterQuery('coreA', 'Q2')
        cq.setCoreQuery(core='coreB', query='Q3')
        cq.addFilterQuery('coreB', 'Q4')
        cq.addMatch(dict(core='coreA', uniqueKey='keyA'), dict(core='coreB', key='keyB'))
        cq.addUnite(dict(core='coreA', query='Q5'), dict(core='coreB', query='Q6'))
        cq.unqualifiedTermFields = [('field0', 2.0), ('field1', 3.0)]

        convertCoreA = lambda query, unqualifiedTermFields=None, **kwargs: "Converted_A_{0}_{1}".format(query, not unqualifiedTermFields is None)
        convertCoreB = lambda query, **kwargs: "Converted_B_{0}".format(query)
        cq.convertWith(coreA=convertCoreA, coreB=convertCoreB)

        self.assertEquals("Converted_A_Q0_True", cq.queryFor('coreA'))
        self.assertEquals(["Converted_A_Q1_True", "Converted_A_Q2_True"], cq.filterQueriesFor('coreA'))
        self.assertEquals("Converted_B_Q3", cq.queryFor('coreB'))
        self.assertEquals(["Converted_B_Q4"], cq.filterQueriesFor('coreB'))
        self.assertEqual(1, len(cq.unites))
        uniteQueries = list(cq.unites[0].queries())
        self.assertEquals('Converted_A_Q5_True', uniteQueries[0][0]['query'])
        self.assertEquals('Converted_B_Q6', uniteQueries[1][0]['query'])
开发者ID:seecr,项目名称:meresco-lucene,代码行数:25,代码来源:composedquerytest.py

示例3: testFilterQueries

# 需要导入模块: from meresco.lucene.composedquery import ComposedQuery [as 别名]
# 或者: from meresco.lucene.composedquery.ComposedQuery import filterQueriesFor [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)
开发者ID:FashtimeDotCom,项目名称:meresco-lucene,代码行数:24,代码来源:composedquerytest.py

示例4: testAddFilterQueriesIncremental

# 需要导入模块: from meresco.lucene.composedquery import ComposedQuery [as 别名]
# 或者: from meresco.lucene.composedquery.ComposedQuery import filterQueriesFor [as 别名]
    def testAddFilterQueriesIncremental(self):
        cq = ComposedQuery('coreA')
        cq.addFilterQuery(core='coreA', query='Q1')
        cq.addFilterQuery(core='coreA', query='Q2')

        self.assertEquals(['Q1', 'Q2'], cq.filterQueriesFor('coreA'))
开发者ID:FashtimeDotCom,项目名称:meresco-lucene,代码行数:8,代码来源:composedquerytest.py


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