|
@ -332,18 +332,18 @@ func isRangeOperation(op query.Operator) bool { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
func (txi *TxIndex) match(c query.Condition, startKey []byte) (hashes [][]byte) { |
|
|
|
|
|
|
|
|
func (txi *TxIndex) match(c query.Condition, startKeyBz []byte) (hashes [][]byte) { |
|
|
if c.Op == query.OpEqual { |
|
|
if c.Op == query.OpEqual { |
|
|
it := dbm.IteratePrefix(txi.store, startKey) |
|
|
|
|
|
|
|
|
it := dbm.IteratePrefix(txi.store, startKeyBz) |
|
|
defer it.Close() |
|
|
defer it.Close() |
|
|
for ; it.Valid(); it.Next() { |
|
|
for ; it.Valid(); it.Next() { |
|
|
hashes = append(hashes, it.Value()) |
|
|
hashes = append(hashes, it.Value()) |
|
|
} |
|
|
} |
|
|
} else if c.Op == query.OpContains { |
|
|
} else if c.Op == query.OpContains { |
|
|
// XXX: doing full scan because startKey does not apply here
|
|
|
|
|
|
// For example, if startKey = "account.owner=an" and search query = "accoutn.owner CONSISTS an"
|
|
|
|
|
|
// we can't iterate with prefix "account.owner=an" because we might miss keys like "account.owner=Ulan"
|
|
|
|
|
|
it := txi.store.Iterator(nil, nil) |
|
|
|
|
|
|
|
|
// XXX: startKey does not apply here.
|
|
|
|
|
|
// For example, if startKey = "account.owner/an/" and search query = "accoutn.owner CONTAINS an"
|
|
|
|
|
|
// we can't iterate with prefix "account.owner/an/" because we might miss keys like "account.owner/Ulan/"
|
|
|
|
|
|
it := dbm.IteratePrefix(txi.store, startKey(c.Tag)) |
|
|
defer it.Close() |
|
|
defer it.Close() |
|
|
for ; it.Valid(); it.Next() { |
|
|
for ; it.Valid(); it.Next() { |
|
|
if !isTagKey(it.Key()) { |
|
|
if !isTagKey(it.Key()) { |
|
|