VisualStudioFeeds

All Visual Studio blogs in one place

AddThis Social Bookmark Button
Now we have all of the data loaded in, we need to be able to search on it. In order to do that, we define the following index: It is a very simple one, mapping the start and end of each range for each location. The next step is actually doing the search, and this is where we run into some issues. The problem was with the data: Let us take the first range and translate that to IP addresses in the format that you are probably more used to: Start: 0.177.195.68 End: 255.177.195.68 Yep,
it is little endian vs. big endian here to bite us once more. It took me a while to figure it out, I’ll admit. In other words, we have to reverse the IP address before we can search on it properly. Thankfully, that is easily done, and we have the following masterpiece: The data source that we have only support IPv4, so that is what we allow. We reverse the IP, then do a range search based on this. Now we can use it like this: var location = session.GetLocationByIp(IPAddress.Parse("209.85.217.172")); Which tells us that this is a...(Read whole news on source site)

Search

Subscribe

Enter your email address:

Delivered by FeedBurner

Increase your website traffic with Attracta.com

Contact

Email:
Subject:
Message:
Anti-spam: How many eyes has a typical person?

Follow us on FB

Home : Blog List : Ayende @ Rahien : Geo Location & Spatial Searches with RavenDB–Part IV-Searching