Confused by range search

Ohai,

Maybe I’m expecting too much, but this is slightly confusing:

$ knife search ‘ipaddress:[172.26.133.95 TO 172.26.133.99]’|grep IP|sort
IP: 172.26.133.95
IP: 172.26.133.96
IP: 172.26.133.97
IP: 172.26.133.98
IP: 172.26.133.99

$ knife search 'ipaddress:[172.26.133.95 TO 172.26.133.105]'
0 items found

Seems like I have to match the number of digits for the range query to work:

$ knife search ‘ipaddress:[172.26.133.100 TO 172.26.133.105]’|grep IP|sort
IP: 172.26.133.100
IP: 172.26.133.101
IP: 172.26.133.102
IP: 172.26.133.103
IP: 172.26.133.104
IP: 172.26.133.105

Is this WAD?

/Jeppe

jeppe@ingolfs.dk writes:

Maybe I'm expecting too much, but this is slightly confusing:

$ knife search 'ipaddress:[172.26.133.95 TO 172.26.133.99]'|grep IP|sort
IP: 172.26.133.95
IP: 172.26.133.96
IP: 172.26.133.97
IP: 172.26.133.98
IP: 172.26.133.99

$ knife search 'ipaddress:[172.26.133.95 TO 172.26.133.105]'
0 items found

Seems like I have to match the number of digits for the range query to work:

$ knife search 'ipaddress:[172.26.133.100 TO 172.26.133.105]'|grep IP|sort
IP: 172.26.133.100
IP: 172.26.133.101
IP: 172.26.133.102
IP: 172.26.133.103
IP: 172.26.133.104
IP: 172.26.133.105

Is this WAD?

The sorting in range queries is done lexicographically so the problem
you are seeing is that, as text, 95 > 105.

So this is "expected", but understandably confusing/surprising since
we know those are IP addresses and how to sort them :slight_smile:

  • seth

--
Seth Falcon | Development Lead | Opscode | @sfalcon