Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Ranjit J. Vaity 66 posts 109 karma points
    Jan 29, 2010 @ 23:45
    Ranjit J. Vaity
    0

    Going ahead with right and optimized approch

    Hi,

    I am a .NET developer working on project to be developed using Umbraco and need a advice on the functionality I am working on. Donno this is the right place to post questions, Hoping I get help in this.

     

     Client requirement:

    Client is having their 40+ medical center across US. And on their site they will have a search functionality that will list down nearest center to the user all with calculated distance in miles. clicking on center will show details of the center and google map pin point.

     My thoughts:
     1. Create a search template that will hold Search control
     2. This template will have State template by which we will create State type pages
     3. State type page will hold City template type pages
     4. Finally city will hold list of pages( center template) in that particular city.
     5. When user enters any word in search I will search all the pages under “Search template“ in particular property called Keyword.
     6. Finding a match will add the document object to Document collection
     7. Finally I will list down the populated collection.
    Document Properties for Center list
     1. Center Name: text
     2. Address 1: text multiple
     3. Address2: text multiple
     4. AreaName: text
     5. City: text
     6. State: text
     7. Zip code: text
     8. Keyword / Meta data (comma separated list- city name, state name, zip code, area name etc):text multiple
     9. GPS location(LONG/LAT) – text
     Issue:
     1. Is this functionality advisable in Umbraco CMS.
     2. How would I calculate miles to that center?
     Any idea, Please share!!
     Thank you in Advance!
     Regards
     Ranjit J. Vaity

  • Seth Niemuth 275 posts 397 karma points
    Jan 30, 2010 @ 00:28
    Seth Niemuth
    0

    I think it makes sense that this can be done in umbraco. If you search for calculating miles between 2 zip codes on google, you get some results:

    http://blogs.techrepublic.com.com/programming-and-development/?p=634

    http://www.wiredprairie.us/blog/index.php/archives/688

    You can put the code into a user control and pass the zip codes to the user control through macro properties...or just use the C# code from in the XSLT if that makes more sense. I don't know if you want the distance for driving (i think these are calculated as the bird flies). If you want the miles for driving, then i am guessing you could get it out from the google maps api (that is just a guess). 

     

  • Ranjit J. Vaity 66 posts 109 karma points
    Jan 30, 2010 @ 08:42
    Ranjit J. Vaity
    0

    Hi Seth, 

    I thank you for your quick reply. The links are really sweet.

    I believe the distance should be for driving. 

    Another suggestion I got is.

     

    1. Maintaining a new db table for these centers and inserting/deleting a record as center page is added in Umbraco admin by capturing publish and delete event.
    2. When I user enters a Keyword it search directly this table a gets the list of matching PageIDs
    3. Later I populate the Document [] from these page IDs and show on Search result page.
    4. When user click on any item, I take user to that particular center page, where I display details and GPS location of that center.

    With this approach, what I see is - we not be able using CMS for searching, Above all, we store same data about centers in 2 different table and additionally I have to maintain a new db objects for this table. On which I am not much happy.  

    If this is the better approach then previous one, I can live with that.

    Requesting reply and suggestions Umbraco community on this so that we can go with best approach.

    Thanks,

    Ranjit J. Vaity

     

     


     

  • Stephan Lonntorp 195 posts 212 karma points
    Jan 30, 2010 @ 10:48
    Stephan Lonntorp
    0

    You really shouldn't use the Document API since that will have a performance hit (the Document API goes directly to the DB), you should use the nodeFactory instead, since it is a representation of the published XML data.

    Apart from that, I'd use the Google Maps API to calculate your distances, as Seth suggests.

    If you only have about 40 centers to keep track of, storing them in the DB doesn't make much sense, if you had 4000 I'd understand.

    I would create a Center DocumentType, with Google Maps coordinates, and data about the center. That way, you'll have that data cached in memory, Umbraco's cached xml, and all you need to do is feed the data from the user's location, along with the data from your centers to Google, and find the nearest one.

    Pretty straight forward, and a fairly simple solution.

  • Seth Niemuth 275 posts 397 karma points
    Jan 30, 2010 @ 11:38
    Seth Niemuth
    0

    Yeah, I agree with Stephan here, on using document types/nodes to store the data as I don't really see a benefit to storing in a separate db table (the plus sides for just storing it all in umbraco is as what stephan has mentioned). Also, at a later date if you want to move that center data, I am guessing you will want it in the format you have specified above and you will have that in an XML file, which is easy to parse.

  • Ranjit J. Vaity 66 posts 109 karma points
    Jan 30, 2010 @ 21:48
    Ranjit J. Vaity
    0

    Hello Stephan and Seth,

    I think I got my answer from you guys. Thank you so much for you replies and time. :)

    Cheers

    Ranjit J. Vaity

  • Sebastiaan Janssen 5060 posts 15522 karma points MVP admin hq
    Jan 31, 2010 @ 21:54
    Sebastiaan Janssen
    0

    Or, instead of writing your own, you could check out the existion Locator Package.. :-)

  • Tushar G. Walavalkar 1 post 21 karma points
    Feb 01, 2010 @ 05:58
    Tushar G. Walavalkar
    0

    API perspective this issue seems resolved. A point I would like you to make is that, centers are not added every day. They are relatively static data. Hence, it would be best to cache the centers' list in memory and write code to interact with the cached version and thus never hitting the DB (directly from pages). If center information is modified, the "OnSubmit " routine should update the cache for that lone record. Assumming memory is not a constraint, this should not be an issue.

    Another optimization for low band-width requests would be to use the ETag in the HttpRequest to further optimize the data transfer. As a user is most likely to review few centers repeatedly, data can indeed be picked up from the browser cache where possible.

  • Ranjit J. Vaity 66 posts 109 karma points
    Feb 01, 2010 @ 06:57
    Ranjit J. Vaity
    0

    Hello Tushar,

    Cool, Thank you for making things better!

    Regards,

    Ranjit J. Vaity

     

  • manishahowale 18 posts 25 karma points
    Feb 01, 2010 @ 07:31
    manishahowale
    0

    Hi All,

    The search functionality required here is not only matching keywords for centers and returning them but e.g. if user enters a center name, or state or zip as "San Fransico" then the centers located at xx miles from San Fransico needs to be retrieved in search result.

    Can you also focus on this part as to doing search nodewise will be a better approach than querying db.

    Thanks in advance,

    Regards,

    Manisha

     

     

     

  • Stephan Lonntorp 195 posts 212 karma points
    Feb 01, 2010 @ 07:50
    Stephan Lonntorp
    0

    Manisha, I'm sure there's a function for that in Google Maps, I suggest you read up on the GData API, as Geo-data is beyond the scope of Umbraco, at least property- and data-wise.

  • Sebastiaan Janssen 5060 posts 15522 karma points MVP admin hq
    Feb 01, 2010 @ 09:27
    Sebastiaan Janssen
    0

    I feel ignored here ;-)

    Once again, the Locator package seems to do most of what you need, the source is available, so is you need some inspiration you can have a look at that.

  • manishahowale 18 posts 25 karma points
    Feb 01, 2010 @ 11:17
    manishahowale
    0

    Thanks for the reply Stephan. We' are already exploring Google maps for this purpose. With the help of the posts and internal discussion we have finalized to use caching collection which will query for searching and not creating a new table. Rest logic I m not putting here but thanks a lot for your time on this issue. It surely helped us to think in a better way.

    Regards,

    Manisha

  • manishahowale 18 posts 25 karma points
    Feb 01, 2010 @ 11:31
    manishahowale
    0

    Hi Sebastiaan,

    Missed your reply as it went to second page. Looking in the same.

    Thanks,

    Manisha

     

  • Ranjit J. Vaity 66 posts 109 karma points
    Feb 01, 2010 @ 20:54
    Ranjit J. Vaity
    0

    Hi Sebastiaan,

    We will certainly go with Locator Package that's excellent datatype for Google Maps. just missed out to reply on your comments.

    I do appreciate your contribution in this healthy discussion we had.

    And want to Thank you all for this.

    Cheers,

    Ranjit J. Vaity 

Please Sign in or register to post replies

Write your reply to:

Draft