Chromium Code Reviews| Index: service/datastore/query.go |
| diff --git a/service/datastore/query.go b/service/datastore/query.go |
| index a68bca28686611eac9cead0e1feecf324c656c05..fc30f5f686808fc6f697a000c6be3bdf94e0cf65 100644 |
| --- a/service/datastore/query.go |
| +++ b/service/datastore/query.go |
| @@ -270,11 +270,13 @@ func (q *Query) Eq(field string, values ...interface{}) *Query { |
| return |
| } |
| idx := sort.Search(len(s), func(i int) bool { |
| - return s[i].Equal(&p) |
| + // s[i] >= p is the same as: |
| + return s[i].Equal(&p) || p.Less(&s[i]) |
| }) |
| - if idx == len(s) { |
| - s = append(s, p) |
| - sort.Sort(s) |
| + if idx == len(s) || !s[idx].Equal(&p) { |
| + s = append(s, Property{}) |
| + copy(s[idx+1:], s[idx:]) |
|
dnj
2015/10/15 02:23:46
nit: WDYT about making eqfilts a binheap?
|
| + s[idx] = p |
| } |
| } |
| q.eqFilts[field] = s |