Single-page app with dynamic filtering - 2 options to proceed

16 views
Skip to first unread message

Jack

unread,
Dec 18, 2017, 3:36:01 PM12/18/17
to Django users

I am building a real estate listings map, which dynamically refreshes its filter whenever the user moves the map. The page never refreshes when a change is made. Think Zillow/Trulia.

There are 2 main filters:

  • Filter properties within the user's viewport
  • Filter properties according to user's custom filter (e.g. property type, # of bedrooms, etc.)

I see 2 methods of approaching this problem.

  1. On initial visit, pass ALL properties in the database to the user. And then filter these properties whenever the user moves his map or changes his filter selection.

  2. Create an ajax call whenever the user moves his map or changes his filter selection. The ajax call will only return the properties that match the user's current requirements.

Which method is preferable? I estimate there will be maybe 200k-300k records in my database.

Matemática A3K

unread,
Dec 18, 2017, 6:39:54 PM12/18/17
to django...@googlegroups.com
On Mon, Dec 18, 2017 at 5:36 PM, Jack <valac...@gmail.com> wrote:

I am building a real estate listings map, which dynamically refreshes its filter whenever the user moves the map. The page never refreshes when a change is made. Think Zillow/Trulia.

There are 2 main filters:

  • Filter properties within the user's viewport
  • Filter properties according to user's custom filter (e.g. property type, # of bedrooms, etc.)

I see 2 methods of approaching this problem.

  1. On initial visit, pass ALL properties in the database to the user. And then filter these properties whenever the user moves his map or changes his filter selection.

This may delay the "first page" or initialization but it would produce a better experience after
  1. Create an ajax call whenever the user moves his map or changes his filter selection. The ajax call will only return the properties that match the user's current requirements.

This would create more traffic to your server, depending on the roundtrip length it may affect the user experience and your server workload, but it would load faster and for "short navigations spans" might be better

Which method is preferable? I estimate there will be maybe 200k-300k records in my database.

Depends on which you want to prioritize or target :)
 

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/7e6179d4-2274-4aec-aa83-27fbfdc1238c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages