hunt-framework / hunt

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

Hunt.Query.Grammer: printQuery is not completely correct #90

Closed chrisreu closed 10 years ago

chrisreu commented 10 years ago

It does fail in certain cases, which not always occure when running the tests.

Example:

Query Parser Properties:
  prop_ParseAnd: [Failed]
*** Failed! Falsifiable (after 24 tests): 
QContext ["3pQMtqlUXmLbnen2n5yrDUo","jvEfRgJyiL"] (QContext ["MAyT7zGbNHpqBBQsplj","eTAUxxeU46Jj4"] (QSeq Phrase [QFullWord QCase "XmHEVrCpxYEk0ooE",QFullWord QCase "X",QFullWord QCase "NktlrDwsCUHndGt"]))
chrisreu commented 10 years ago

Seems to be a problem with stacking ContextQueries. The rendered Query need to have brackets

Original query:

QSeq And [QContext ["c3","c4"] (QContext ["c5","c6"] (QWord QCase "w4"))]

rendered with printQuery: "c3,c4:c5,c6:!w4"

And parsed again with parseQuery

parsed again: Right (QContext ["c3","c4"] (QWord QNoCase "c5,c6:!w4"))
chrisreu commented 10 years ago

fixed with da2b2ae6cac186f2e703d7ba9bb7a87ea7ba2266