How can I intelligently group rows of integers for a faceted search?

Posted by Alastair on Stack Overflow See other posts from Stack Overflow or by Alastair
Published on 2010-12-31T16:40:13Z Indexed on 2010/12/31 16:54 UTC
Read the original article Hit count: 251

Filed under:
|
|

I'm not even quite sure what terms I should be using for what I want, so any advice on what I'm even asking for would be very welcome.

Basically, my web site lists user-generated accommodations. Each has a rent price, which users will be able to query in our new faceted search box.

Users search by city, and within each city I'd like to present a different rent grouping. That is to say that in City #1, if we have listings ranging from $200 - $1000, I'd like to present checkboxes for:

  • less than $300
  • $301 - $500
  • $501 - $700
  • more than $700

However, if City #2 has values that range from $500 - $1500, I want the ranges above to change accordingly. So, if I say that I want 5 or 6 range options in each city, I think I have two options:

  1. Take the min and max values and just split the difference. I don't like this idea because one listing with a rent of $10,000 will throw the whole scale off.

  2. Intelligently calculate the ranges using means, medians etc.

Number 2 is what I need help with. I'm a web developer that gets logic, but was never strong on math and statistics at school. Can anyone point me towards a guide that'll help me figure this out?

© Stack Overflow or respective owner

Related posts about c#

Related posts about math