예제 #1
0
def test_parse_combined():
    searchquery = u"((fulltext=münchen) OR (title=münchen)) AND ((NOT (full=Strauß)) OR (year > 2000))"
    st = parser.parse_string(searchquery)
    left = Or(FulltextMatch(u"münchen"), AttributeMatch(u"title", u"münchen"))
    right = Or(Not(FullMatch(u"Strauß")), AttributeCompare(u"year", ">", u"2000"))
    assert isinstance(st, And)
    assert st.left == left
    assert st.right == right
예제 #2
0
def test_parse_combined():
    searchquery = u"((fulltext=münchen) OR (title=münchen)) AND ((NOT (full=Strauß)) OR (year > 2000))"
    st = parser.parse_string(searchquery)
    left = Or(FulltextMatch(u"münchen"), AttributeMatch(u"title", u"münchen"))
    right = Or(Not(FullMatch(u"Strauß")),
               AttributeCompare(u"year", ">", u"2000"))
    assert isinstance(st, And)
    assert st.left == left
    assert st.right == right
예제 #3
0
def test_parse_not():
    st = parser.parse_string(u'not(full=torpedo)')
    assert st == Not(FullMatch(u"torpedo"))
예제 #4
0
def test_parse_plain_and():
    st = parser.parse_string(u'full=haus and full=ofit')
    assert st == And(FullMatch(u"haus"), FullMatch(u"ofit"))
예제 #5
0
def test_parse_plain_or():
    st = parser.parse_string(u'full=haus or full=ofit')
    assert st == Or(FullMatch(u"haus"), FullMatch(u"ofit"))
예제 #6
0
def test_parse_full_unicode_quoted():
    text = u'"Öffentliche schöne Häuser in München"'
    st = parser.parse_string(u'full=' + text)
    assert st == FullMatch(text.strip('"'))
예제 #7
0
def test_parse_simple_query(simple_query):
    searchquery, expected = simple_query
    st = parser.parse_string(searchquery)
    assert st == expected
예제 #8
0
def test_parse_unicode():
    text = u"πλανήτης\uEEEE"
    st = parser.parse_string(u"full=" + text)
    assert st == FullMatch(text)
예제 #9
0
def test_parse_not():
    st = parser.parse_string(u'not(full=torpedo)')
    assert st == Not(FullMatch(u"torpedo"))
예제 #10
0
def test_parse_plain_and():
    st = parser.parse_string(u'full=haus and full=ofit')
    assert st == And(FullMatch(u"haus"), FullMatch(u"ofit"))
예제 #11
0
def test_parse_plain_or():
    st = parser.parse_string(u'full=haus or full=ofit')
    assert st == Or(FullMatch(u"haus"), FullMatch(u"ofit"))
예제 #12
0
def test_parse_full_unicode_quoted():
    text = u'"Öffentliche schöne Häuser in München"'
    st = parser.parse_string(u'full=' + text)
    assert st == FullMatch(text.strip('"'))
예제 #13
0
def test_parse_simple_query(simple_query):
    searchquery, expected = simple_query
    st = parser.parse_string(searchquery)
    assert st == expected
예제 #14
0
def test_parse_unicode():
    text = u"πλανήτης\uEEEE"
    st = parser.parse_string(u"full=" + text)
    assert st == FullMatch(text)