patrickfrey / strusWebService

web service (HTTP/JSON) to use the strus API as a service
http://project-strus.net
Mozilla Public License 2.0
4 stars 0 forks source link

query tests are failing #29

Closed andreasbaumann closed 6 years ago

andreasbaumann commented 6 years ago
The following tests FAILED:
         28 - query_in_url (Failed)
         29 - query_A (Failed)

This one seems trivial:

1c1
< {"err":{"code":4011,"msg":"cannot evaluate query, no selection features defined"},"result":"error"}

---
> {"ranklist":{"ranks":[{"attributes":[{"key":"docid","value":"doc3"},{"key":"title","value":"This is a Hello World Document"}],"docno":4,"weight":0},{"attributes":[{"key":"docid","value":"doc2"},{"key":"title","value":"This is a Hello World Document"}],"docno":2,"weight":0},{"attributes":[{"key":"docid","value":"doc1"},{"key":"title","value":"This is a Hello World Document"}],"docno":1,"weight":0}]},"result":"ok"}

Scores and weights are floats which cannot be handled by just diffing the results:

< {"ranklist":{"documents_ranked":3,"documents_visited":3,"passes_evaluated":0,"ranks":[{"attributes":[{"key":"docid","value":"doc3"}],"docno":4,"weight":5.205622073845007e-06},{"attributes":[{"key":"docid","value":"doc2"}],"docno":2,"weight":2.307670229129144e-06},{"attributes":[{"key":"docid","value":"doc1"}],"docno":1,"weight":1.110571247409098e-06}]},"result":"ok"}

---
> {"ranklist":{"ranks":[{"attributes":[{"key":"attribute","value":"doc3"}],"docno":3,"weight":1.850274916547851e-16},{"attributes":[{"key":"attribute","value":"doc2"}],"docno":2,"weight":1.850274916547851e-16},{"attributes":[{"key":"attribute","value":"doc1"}],"docno":1,"weight":1.850274916547851e-16}]},"result":"ok"}

We must demarshall the .res and the .must file and make a special comparition operation for floats.

andreasbaumann commented 6 years ago

same here:

shell> diff tests/document_url_docid_insert.{must,res}
1c1
< {"result":"ok"}
---
> {"execution_time":0.070658899,"result":"ok"}

We have to read the must and the res file, demarshall them, ignore some fields like execution_time and normalize some others like weight.

andreasbaumann commented 6 years ago

fixed the tests, but the weights are still flipping from machine to machine.

patrickfrey commented 6 years ago

The weights should be compared with less precision.