mirror of
https://github.com/fluencelabs/tendermint
synced 2025-04-24 22:32:15 +00:00
parent
0f96bea41d
commit
c4a1cfc5c2
@ -21,3 +21,4 @@ Special thanks to external contributors on this release:
|
|||||||
### IMPROVEMENTS:
|
### IMPROVEMENTS:
|
||||||
|
|
||||||
### BUG FIXES:
|
### BUG FIXES:
|
||||||
|
- [kv indexer] \#2912 don't ignore key when executing CONTAINS
|
@ -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
|
// XXX: startKey does not apply here.
|
||||||
// For example, if startKey = "account.owner=an" and search query = "accoutn.owner CONSISTS an"
|
// 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"
|
// we can't iterate with prefix "account.owner/an/" because we might miss keys like "account.owner/Ulan/"
|
||||||
it := txi.store.Iterator(nil, nil)
|
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()) {
|
||||||
|
@ -89,8 +89,10 @@ func TestTxSearch(t *testing.T) {
|
|||||||
{"account.date >= TIME 2013-05-03T14:45:00Z", 0},
|
{"account.date >= TIME 2013-05-03T14:45:00Z", 0},
|
||||||
// search using CONTAINS
|
// search using CONTAINS
|
||||||
{"account.owner CONTAINS 'an'", 1},
|
{"account.owner CONTAINS 'an'", 1},
|
||||||
// search using CONTAINS
|
// search for non existing value using CONTAINS
|
||||||
{"account.owner CONTAINS 'Vlad'", 0},
|
{"account.owner CONTAINS 'Vlad'", 0},
|
||||||
|
// search using the wrong tag (of numeric type) using CONTAINS
|
||||||
|
{"account.number CONTAINS 'Iv'", 0},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, tc := range testCases {
|
for _, tc := range testCases {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user