Commit ee9c9637 authored by Geoff Simmons's avatar Geoff Simmons

Query evaluation uses the new function to extract fields from payloads.

parent d7f2fb35
...@@ -73,12 +73,11 @@ func (expr qExpr) testRecord(rec Record) bool { ...@@ -73,12 +73,11 @@ func (expr qExpr) testRecord(rec Record) bool {
payload = bytes.TrimLeft(payload, " \t\n\r") payload = bytes.TrimLeft(payload, " \t\n\r")
} }
if expr.lhs.field > 0 { if expr.lhs.field > 0 {
fld := expr.lhs.field min, max, ok := fieldNDelims(payload, expr.lhs.field-1)
flds := bytes.Fields(payload) if !ok {
if fld > len(flds) {
return false return false
} }
payload = flds[fld-1] payload = payload[min:max]
} }
if expr.rhs.rhsType == empty { if expr.rhs.rhsType == empty {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment