Example #1
0
    def test_substituted_value_never_contains_any_wildcards(self):
        # Simple term
        orig_query = '*f*oo*'
        pattern = '{value}'
        mangled_query = mangle_searchable_text_query(orig_query, pattern)
        self.assertEquals('foo', mangled_query)

        # Simple search
        orig_query = 'foo* *bar'
        pattern = '{value}'
        mangled_query = mangle_searchable_text_query(orig_query, pattern)
        self.assertEquals('(foo bar)', mangled_query)
Example #2
0
 def test_simple_search_results_in_simple_pattern_substitution(self):
     orig_query = 'foo bar'
     pattern = '{value}'
     mangled_query = mangle_searchable_text_query(orig_query, pattern)
     self.assertEquals(
         '(foo bar)',
         mangled_query)
Example #3
0
 def test_simple_search_substitutes_lwc_and_twc_values(self):
     orig_query = 'foo bar'
     pattern = '{value_lwc} OR {value_twc}'
     mangled_query = mangle_searchable_text_query(orig_query, pattern)
     self.assertEquals(
         '(*foo *bar) OR (foo* bar*)',
         mangled_query)
Example #4
0
 def test_simple_terms_value_contains_no_wildcards(self):
     orig_query = 'foo'
     pattern = '{value}'
     mangled_query = mangle_searchable_text_query(orig_query, pattern)
     self.assertEquals(
         'foo',
         mangled_query)