j2inn / haystack-nclient

Project Haystack client network TypeScript library
BSD 3-Clause "New" or "Revised" License
11 stars 4 forks source link

ExtOpsService fails to evaluate a filter containing a string #23

Closed gretadj2 closed 2 years ago

gretadj2 commented 2 years ago

Problem

If you try to evaluate a haystack filter containing a string, you can observe different behaviours depending on which haystack client service you use to evaluate the filter.

Example:

    const client = useClient()
    const filter = 'dis == "Site"'
    // This fails
    client.ext
        .read(filter)
        .then((grid) => console.log('ext', grid.getRows()[0].toString()))
        .catch((e) => console.error('ext threw an error', e))
    // This succeeds
    client.ops
        .read(filter)
        .then((grid) => console.log('ops', grid.getRows()[0].toString()))
        .catch((e) => console.error('ops threw an error', e))

    // The filter is valid
    try {
        HFilter.parse(filter)
        console.log(filter, 'valid')
    } catch (e) {
        console.log(filter, 'invalid')
    }

The ExtOpsService fails because it is sending an invalid request:

ver:"3.0"
expr
"parseFilter(\"dis == \"Site\"\").readAll()"

Expected behaviour

The expected behaviour should probably be getting the same result no matter which of the two services (ExtOpsService or OpsService) you use to perform the read.