hunt-framework / hunt

A flexible, lightweight search platform
59 stars 10 forks source link

Lots of Parser Tests fail #85

Closed sebastian-philipp closed 10 years ago

sebastian-philipp commented 10 years ago
Query Parser Hunit tests:
  :Or tests:
    : [Failed]
Ignoring whitespace
expected: Right (QSeq Or [QWord QNoCase "abc",QWord QNoCase "def",QWord QNoCase "ghi",QWord QNoCase "jkl"])
 but got: Right (QSeq Or [QWord QNoCase "abc",QWord QNoCase "def",QSeq And [QWord QNoCase "ghi",QWord QNoCase "OR\njkl"]])
    : [Failed]
Operator precedence
expected: Right (QSeq And [QContext ["wurst"] (QWord QNoCase "abc"),QSeq Or [QWord QNoCase "def",QWord QNoCase "ghi"],QContext ["wurst"] (QWord QNoCase "jkl")])
 but got: Right (QSeq Or [QSeq And [QContext ["wurst"] (QWord QNoCase "abc"),QWord QNoCase "def"],QSeq And [QWord QNoCase "ghi",QContext ["wurst"] (QWord QNoCase "jkl")]])
  :And Not tests:
    : [Failed]
Concatenating 'and' terms
expected: Right (QSeq AndNot [QWord QNoCase "abc",QSeq AndNot [QWord QNoCase "def",QWord QNoCase "ghi"]])
 but got: Right (QSeq AndNot [QWord QNoCase "abc",QWord QNoCase "def",QWord QNoCase "ghi"])
    : [Failed]
Ignoring whitespace
expected: Right (QSeq AndNot [QWord QNoCase "abc",QSeq AndNot [QWord QNoCase "def",QSeq AndNot [QWord QNoCase "ghi",QWord QNoCase "jkl"]]])
 but got: Right (QSeq AndNot [QWord QNoCase "abc",QWord QNoCase "def",QWord QNoCase "ghi",QWord QNoCase "jkl"])
    : [Failed]
Priorities
expected: Right (QSeq AndNot [QContext ["wurst"] (QWord QNoCase "abc"),QSeq AndNot [QWord QNoCase "def",QSeq AndNot [QWord QNoCase "ghi",QContext ["wurst"] (QWord QNoCase "jkl")]]])
 but got: Right (QSeq AndNot [QContext ["wurst"] (QWord QNoCase "abc"),QWord QNoCase "def",QWord QNoCase "ghi",QContext ["wurst"] (QWord QNoCase "jkl")])
  :Specifier tests:
    : [Failed]
Specifier priority
expected: Right (QSeq And [QWord QNoCase "abc",QContext ["wurst"] (QWord QNoCase "def"),QSeq Or [QContext ["wurst"] (QWord QNoCase "ghi"),QContext ["wurst"] (QWord QNoCase "jkl")]])
 but got: Right (QSeq Or [QSeq And [QWord QNoCase "abc",QContext ["wurst"] (QWord QNoCase "def"),QContext ["wurst"] (QWord QNoCase "ghi")],QContext ["wurst"] (QWord QNoCase "jkl")])
    : [Failed]
Specifier lists with phrase
expected: Right (QContext ["wurst","batzen","schinken"] (QSeq Phrase [QFullWord QCase "this",QFullWord QCase "is",QFullWord QCase "A",QFullWord QCase "Test"]))
 but got: Right (QContext ["wurst","batzen","schinken"] (QPhrase QNoCase "this is A Test"))
  :Case tests:
    : [Failed]
Simple case-sensitive phrase
expected: Right (QSeq Phrase [QFullWord QCase "this",QFullWord QCase "is",QFullWord QCase "a",QFullWord QCase "test"])
 but got: Right (QPhrase QCase "this is a test")
  :Parenthese tests:
    : [Failed]
Parentheses without effect
expected: Right (QSeq Or [QSeq And [QWord QNoCase "abc",QWord QNoCase "def"],QWord QNoCase "ghi"])
 but got: Right (QSeq And [QWord QNoCase "abc",QSeq Or [QWord QNoCase "def",QWord QNoCase "ghi"]])
  :Phrase tests:
    : [Failed]
Ignoring whitespace without case operator
expected: Right (QSeq Phrase [QFullWord QCase "wurst",QFullWord QCase "schinken",QFullWord QCase "batzen"])
 but got: Right (QPhrase QNoCase "wurst schinken batzen")
    : [Failed]
Ignoring whitespace with case operator
expected: Right (QSeq Phrase [QFullWord QCase "wurst",QFullWord QCase "schinken",QFullWord QCase "batzen"])
 but got: Right (QPhrase QCase "wurst schinken batzen")
    : [Failed]
Boosting a phrase
expected: Right (QBoost (SC {unScore = 9.0}) (QFullWord QNoCase "word"))
 but got: Right (QBoost (SC {unScore = 9.0}) (QPhrase QNoCase "word"))
    : [Failed]
Boosting a binary query with parantheses
expected: Right (QBoost (SC {unScore = 9.0}) (QSeq And [QWord QNoCase "w",QSeq Or [QWord QNoCase "k",QWord QNoCase "p"]]))
 but got: Right (QBoost (SC {unScore = 9.0}) (QSeq Or [QSeq And [QWord QNoCase "w",QWord QNoCase "k"],QWord QNoCase "p"]))
Ranking: Boosting: [Failed]
UweSchmidt commented 10 years ago

Yes, the parser works a bit different, OR now binds less than AND and AND NOT, with the earlier version this was the other way round.

UweSchmidt commented 10 years ago

Parser and tests modified to work as expected.