# Copenda.com - How Are They Doing This?

**URL:** <https://www.ruby-forum.com/t/copenda-com-how-are-they-doing-this/137763>\
**Category:** Rails\
**Created:** [May 16, 2008, 2:11am UTC](https://www.ruby-forum.com/t/copenda-com-how-are-they-doing-this/137763 "2008-05-16T02:11:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![wickNbomb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/e480ec/32.png) [@wickNbomb](https://www.ruby-forum.com/u/wickNbomb)\
**Post date:** [May 16, 2008, 2:11am UTC](https://www.ruby-forum.com/t/copenda-com-how-are-they-doing-this/137763/1 "2008-05-16T02:11:57Z")

</div>

Does anyone have any thoughts on how Copenda is pulling off search  
results like this?

[http://www.copenda.com/SearchResults.aspx?gender=1&lookingfor=2&ageMin=29&ageMax=36&locatednear=CAMPBELL,%20CA&distance=10&savesearch=1&searchsafe=1&advancedsearch=0&showSearchBox=true](http://www.copenda.com/SearchResults.aspx?gender=1&lookingfor=2&ageMin=29&ageMax=36&locatednear=CAMPBELL,%20CA&distance=10&savesearch=1&searchsafe=1&advancedsearch=0&showSearchBox=true)

I’ve looked through the Myspace API docs and from what I can tell you  
can only pull info for a specific user and they don’t support any kind  
of global search like this result…

Are they page scraping into their own model and THEN querying against  
that?

Just curious as I’ve never come across this sort of implementation  
before.

Thanks!

---

<div class="post-metadata">

**Author:** ![wickNbomb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/e480ec/32.png) [@wickNbomb](https://www.ruby-forum.com/u/wickNbomb)\
**Post date:** [May 16, 2008, 10:32pm UTC](https://www.ruby-forum.com/t/copenda-com-how-are-they-doing-this/137763/2 "2008-05-16T22:32:00Z")

</div>

wick,

I’m not familiar enough with either (Copenda or Myspace’s API), but if  
it’s just the “fuzzyness” you are looking to replicate, that’s easy  
enough.

There are two fuzzy things they are doing:

1. age range criteria
2. location criteria

The first one is very straightforward as it’s just a matter of  
choosing a min and max then doing a conditional query between them.  
Looks like you can do:

Person.find(:all, :conditions =\> { :age =\> min…max })

(From here:  
[http://dev.rubyonrails.org/changeset/5876http://dev.rubyonrails.org/changeset/5876](http://dev.rubyonrails.org/changeset/5876http://dev.rubyonrails.org/changeset/5876))

The second one would be pretty easy by using the geokit plugin:  
[http://geokit.rubyforge.org/](http://geokit.rubyforge.org/) which would let you store lat/long values  
as well as find results by using various geographical calculations by  
radius.

If your question is more about how they get that data… well, I can’t  
help you much there. Possibly screen scraping (easy enough… try  
hpricot… I’ve heard that’s a useful tool)… or maybe there’s  
already APIs for getting at the data.

-Danimal

P.S. I like the slider for age selection. That’s slick. Gotta use that  
idea in some of my own apps.
