本文整理汇总了Python中pixelated.adapter.search.SearchEngine.search方法的典型用法代码示例。如果您正苦于以下问题:Python SearchEngine.search方法的具体用法?Python SearchEngine.search怎么用?Python SearchEngine.search使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pixelated.adapter.search.SearchEngine
的用法示例。
在下文中一共展示了SearchEngine.search方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_contents_encoding_accents
# 需要导入模块: from pixelated.adapter.search import SearchEngine [as 别名]
# 或者: from pixelated.adapter.search.SearchEngine import search [as 别名]
def test_contents_encoding_accents(self):
# given
se = SearchEngine(INDEX_KEY, self.user_home)
headers = {
"From": "[email protected]",
"To": "=?utf-8?b?IsOEw7zDtiDDlsO8w6QiIDxmb2xrZXJAcGl4ZWxhdGVkLXByb2plY3Qub3Jn?=\n =?utf-8?b?PiwgRsO2bGtlciA8Zm9sa2VyQHBpeGVsYXRlZC1wcm9qZWN0Lm9yZz4=?=",
"Cc": "=?utf-8?b?IsOEw7zDtiDDlsO8w6QiIDxmb2xrZXJAcGl4ZWxhdGVkLXByb2plY3Qub3Jn?=\n =?utf-8?b?PiwgRsO2bGtlciA8Zm9sa2VyQHBpeGVsYXRlZC1wcm9qZWN0Lm9yZz4=?=",
"Subject": "Some test mail",
"Date": str(datetime.now()),
}
body = "When doing the search, it's not possible to find words with graphical accents, e.g.: 'coração', 'é', 'Fièvre', La Pluie d'été, 'não'."
# when
se.index_mail(
LeapMail("mailid", "INBOX", headers=headers, body=body)
) # test_helper.pixelated_mail(extra_headers=headers, chash='mailid'))
result = se.search(u"'coração', 'é',")
self.assertEqual((["mailid"], 1), result)
result = se.search(u"Fièvre")
self.assertEqual((["mailid"], 1), result)
result = se.search(u"été")
self.assertEqual((["mailid"], 1), result)
示例2: test_contents_encoding_special_characters
# 需要导入模块: from pixelated.adapter.search import SearchEngine [as 别名]
# 或者: from pixelated.adapter.search.SearchEngine import search [as 别名]
def test_contents_encoding_special_characters(self):
# given
se = SearchEngine(INDEX_KEY, self.user_home)
headers = {
'From': '[email protected]',
'To': '=?utf-8?b?IsOEw7zDtiDDlsO8w6QiIDxmb2xrZXJAcGl4ZWxhdGVkLXByb2plY3Qub3Jn?=\n =?utf-8?b?PiwgRsO2bGtlciA8Zm9sa2VyQHBpeGVsYXRlZC1wcm9qZWN0Lm9yZz4=?=',
'Cc': '=?utf-8?b?IsOEw7zDtiDDlsO8w6QiIDxmb2xrZXJAcGl4ZWxhdGVkLXByb2plY3Qub3Jn?=\n =?utf-8?b?PiwgRsO2bGtlciA8Zm9sa2VyQHBpeGVsYXRlZC1wcm9qZWN0Lm9yZz4=?=',
'Subject': 'Some test mail',
}
body = "When doing the search, 您好 أهلا"
# when
se.index_mail(LeapMail('mailid', 'INBOX', headers=headers, body=body)) # test_helper.pixelated_mail(extra_headers=headers, chash='mailid'))
result = se.search(u"您好")
self.assertEqual((['mailid'], 1), result)
result = se.search(u"أهلا")
self.assertEqual((['mailid'], 1), result)
示例3: test_contents_encoding_accents
# 需要导入模块: from pixelated.adapter.search import SearchEngine [as 别名]
# 或者: from pixelated.adapter.search.SearchEngine import search [as 别名]
def test_contents_encoding_accents(self):
# given
se = SearchEngine(INDEX_KEY, self.agent_home)
headers = {
'From': '[email protected]',
'To': '=?utf-8?b?IsOEw7zDtiDDlsO8w6QiIDxmb2xrZXJAcGl4ZWxhdGVkLXByb2plY3Qub3Jn?=\n =?utf-8?b?PiwgRsO2bGtlciA8Zm9sa2VyQHBpeGVsYXRlZC1wcm9qZWN0Lm9yZz4=?=',
'Cc': '=?utf-8?b?IsOEw7zDtiDDlsO8w6QiIDxmb2xrZXJAcGl4ZWxhdGVkLXByb2plY3Qub3Jn?=\n =?utf-8?b?PiwgRsO2bGtlciA8Zm9sa2VyQHBpeGVsYXRlZC1wcm9qZWN0Lm9yZz4=?=',
'Subject': 'Some test mail',
}
body = "When doing the search, it's not possible to find words with graphical accents, e.g.: 'coração', 'é', 'Fièvre', La Pluie d'été, 'não'."
# when
se.index_mail(LeapMail('mailid', 'INBOX', headers=headers, body=body)) # test_helper.pixelated_mail(extra_headers=headers, chash='mailid'))
result = se.search(u"'coração', 'é',")
self.assertEqual((['mailid'], 1), result)
result = se.search(u"Fièvre")
self.assertEqual((['mailid'], 1), result)
result = se.search(u"été")
self.assertEqual((['mailid'], 1), result)
示例4: test_contents_encoding_special_characters
# 需要导入模块: from pixelated.adapter.search import SearchEngine [as 别名]
# 或者: from pixelated.adapter.search.SearchEngine import search [as 别名]
def test_contents_encoding_special_characters(self):
# given
se = SearchEngine(INDEX_KEY, self.user_home)
headers = {
"From": "[email protected]",
"To": "=?utf-8?b?IsOEw7zDtiDDlsO8w6QiIDxmb2xrZXJAcGl4ZWxhdGVkLXByb2plY3Qub3Jn?=\n =?utf-8?b?PiwgRsO2bGtlciA8Zm9sa2VyQHBpeGVsYXRlZC1wcm9qZWN0Lm9yZz4=?=",
"Cc": "=?utf-8?b?IsOEw7zDtiDDlsO8w6QiIDxmb2xrZXJAcGl4ZWxhdGVkLXByb2plY3Qub3Jn?=\n =?utf-8?b?PiwgRsO2bGtlciA8Zm9sa2VyQHBpeGVsYXRlZC1wcm9qZWN0Lm9yZz4=?=",
"Subject": "Some test mail",
"Date": str(datetime.now()),
}
body = "When doing the search, 您好 أهلا"
# when
se.index_mail(
LeapMail("mailid", "INBOX", headers=headers, body=body)
) # test_helper.pixelated_mail(extra_headers=headers, chash='mailid'))
result = se.search(u"您好")
self.assertEqual((["mailid"], 1), result)
result = se.search(u"أهلا")
self.assertEqual((["mailid"], 1), result)
示例5: test_headers_encoding
# 需要导入模块: from pixelated.adapter.search import SearchEngine [as 别名]
# 或者: from pixelated.adapter.search.SearchEngine import search [as 别名]
def test_headers_encoding(self):
# given
se = SearchEngine(INDEX_KEY, self.agent_home)
headers = {
'From': '[email protected]',
'To': '=?utf-8?b?IsOEw7zDtiDDlsO8w6QiIDxmb2xrZXJAcGl4ZWxhdGVkLXByb2plY3Qub3Jn?=\n =?utf-8?b?PiwgRsO2bGtlciA8Zm9sa2VyQHBpeGVsYXRlZC1wcm9qZWN0Lm9yZz4=?=',
'Cc': '=?utf-8?b?IsOEw7zDtiDDlsO8w6QiIDxmb2xrZXJAcGl4ZWxhdGVkLXByb2plY3Qub3Jn?=\n =?utf-8?b?PiwgRsO2bGtlciA8Zm9sa2VyQHBpeGVsYXRlZC1wcm9qZWN0Lm9yZz4=?=',
'Subject': 'Some test mail',
}
# when
se.index_mail(LeapMail('mailid', 'INBOX', headers=headers)) # test_helper.pixelated_mail(extra_headers=headers, chash='mailid'))
result = se.search('folker')
self.assertEqual((['mailid'], 1), result)
示例6: test_encoding
# 需要导入模块: from pixelated.adapter.search import SearchEngine [as 别名]
# 或者: from pixelated.adapter.search.SearchEngine import search [as 别名]
def test_encoding(self):
# given
se = SearchEngine(INDEX_KEY, self.agent_home)
headers = {
"From": "[email protected]",
"To": "=?utf-8?b?IsOEw7zDtiDDlsO8w6QiIDxmb2xrZXJAcGl4ZWxhdGVkLXByb2plY3Qub3Jn?=\n =?utf-8?b?PiwgRsO2bGtlciA8Zm9sa2VyQHBpeGVsYXRlZC1wcm9qZWN0Lm9yZz4=?=",
"Cc": "=?utf-8?b?IsOEw7zDtiDDlsO8w6QiIDxmb2xrZXJAcGl4ZWxhdGVkLXByb2plY3Qub3Jn?=\n =?utf-8?b?PiwgRsO2bGtlciA8Zm9sa2VyQHBpeGVsYXRlZC1wcm9qZWN0Lm9yZz4=?=",
"Subject": "Some test mail",
}
# when
se.index_mail(test_helper.pixelated_mail(extra_headers=headers, chash="mailid"))
result = se.search("folker")
self.assertEqual((["mailid"], 1), result)
示例7: test_encoding
# 需要导入模块: from pixelated.adapter.search import SearchEngine [as 别名]
# 或者: from pixelated.adapter.search.SearchEngine import search [as 别名]
def test_encoding(self):
# given
soledad_querier = mock()
when(soledad_querier).get_index_masterkey().thenReturn(INDEX_KEY)
se = SearchEngine(soledad_querier, self.agent_home)
headers = {
'From': '[email protected]',
'To': '=?utf-8?b?IsOEw7zDtiDDlsO8w6QiIDxmb2xrZXJAcGl4ZWxhdGVkLXByb2plY3Qub3Jn?=\n =?utf-8?b?PiwgRsO2bGtlciA8Zm9sa2VyQHBpeGVsYXRlZC1wcm9qZWN0Lm9yZz4=?=',
'Cc': '=?utf-8?b?IsOEw7zDtiDDlsO8w6QiIDxmb2xrZXJAcGl4ZWxhdGVkLXByb2plY3Qub3Jn?=\n =?utf-8?b?PiwgRsO2bGtlciA8Zm9sa2VyQHBpeGVsYXRlZC1wcm9qZWN0Lm9yZz4=?=',
'Subject': 'Some test mail',
}
# when
se.index_mail(test_helper.pixelated_mail(extra_headers=headers, chash='mailid'))
result = se.search('folker')
self.assertEqual((['mailid'], 1), result)