[chef] Re: Confused by range search


Chronological Thread 
  • From: Seth Falcon < >
  • To: < >
  • Subject: [chef] Re: Confused by range search
  • Date: Thu, 22 Aug 2013 10:43:40 -0700



 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 :)

+ seth



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




Archive powered by MHonArc 2.6.16.

§