本文整理汇总了Python中lucene.QueryParser.getClassName方法的典型用法代码示例。如果您正苦于以下问题:Python QueryParser.getClassName方法的具体用法?Python QueryParser.getClassName怎么用?Python QueryParser.getClassName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lucene.QueryParser
的用法示例。
在下文中一共展示了QueryParser.getClassName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testPhraseQuery
# 需要导入模块: from lucene import QueryParser [as 别名]
# 或者: from lucene.QueryParser import getClassName [as 别名]
def testPhraseQuery(self):
analyzer = StandardAnalyzer(Version.LUCENE_24)
q = QueryParser(Version.LUCENE_24, "field",
analyzer).parse('"This is Some Phrase*"')
self.assertEqual("\"some phrase\"", q.toString("field"), "analyzed")
q = QueryParser(Version.LUCENE_CURRENT, "field",
self.analyzer).parse('"term"')
self.assert_("TermQuery" == q.getClassName(), "reduced to TermQuery")
示例2: testTermRangeQuery
# 需要导入模块: from lucene import QueryParser [as 别名]
# 或者: from lucene.QueryParser import getClassName [as 别名]
def testTermRangeQuery(self):
query = QueryParser(Version.LUCENE_CURRENT, "subject",
self.analyzer).parse("title2:[K TO N]")
self.assert_(query.getClassName() == "TermRangeQuery")
scoreDocs = self.searcher.search(query, 10).scoreDocs
self.assertHitsIncludeTitle(self.searcher, scoreDocs, "Mindstorms")
query = QueryParser(Version.LUCENE_CURRENT, "subject",
self.analyzer).parse("title2:{K TO Mindstorms}")
scoreDocs = self.searcher.search(query, 10).scoreDocs
self.assertHitsIncludeTitle(self.searcher, scoreDocs, "Mindstorms",
True)