コード例 #1
0
 def test_extended_1(self):
     snippets = (
         Snippet(index='company', config=SearchConfig)
         .for_query("Me amore")
         .from_data("amore", "amore mia")
     )
     self.assertEqual(
         snippets.lex(),
         "CALL SNIPPETS (('amore', 'amore mia'), 'company', 'Me amore')"
     )
コード例 #2
0
 def test_with_options(self):
     snippets = (
         Snippet(index='company', config=SearchConfig)
         .for_query("Me amore")
         .from_data("amore mia")
         .options(before_match='<strong>', after_match='</strong>')
     )
     self.assertEqual(
         snippets.lex(), (
             "CALL SNIPPETS ('amore mia', 'company', 'Me amore', "
             "'<strong>' AS before_match, '</strong>' AS after_match)"
         )
     )