IP value search problem


#1

Hi,
I guessed there is a bit bug in value search.
When I make query on IP Value in CB v3.1.5 as you may find in attach, it did not work properly.
am I right or I made a mistake?



#2

The view considers your IPs as text, so a range is treated with alphanumeric sorting in mind. When you consider this, and look at your start_key and end_key, you start at “3” and end at “1” (IPs start by 37 and 137 respectively). So it’s the same as trying to specify a range starting with Y and ending with C… It effectively make no sense unless you say it’s a range in descending order.

But the root of your problem is you emit an IP in text form, which you then expect to be able to query with the individual parts of the IP considered as numbers (and sorted accordingly).
You probably need to change your view map function. Maybe emit the individual components of the IP, split into an array (and make sure they are emitted as ints)?


#3

OK!
thanks, you are right.